[Coco] OS9 Script Error Handling or File Testing ?
Jeff Teunissen
deek at d2dc.net
Sun Jun 28 02:07:19 EDT 2020
No, that's not correct.
The syntax is more like:
if -w /dd/cmds
then
cd /dd/cmds
ar -x /path/to/proramarchive
else
echo You don't have permission to install.
ex
endif
However, that script fragment will not work because you can't use IF
to check whether a directory is writable with Shell+ -- you can check
that it's a directory, but -W is always false for directories because
it only works for regular files, not directories.
On Sat, Jun 27, 2020 at 7:22 PM <coco at jechar.ca> wrote:
>
> IS THIS CORRECT FOR EXAMPLE ?
>
> if -w /dd/cmds true then cd /dd/cmds else echo "You do not have
> Permission to Install to this System" endif
> if -w /dd/cmds true then ar2 -x proramarchive.ar else echo exit endif
>
> Would this also be correct
>
> if -w /dd/cmds true then
> cd /dd/cmds
> ar2 -x proramarchive.ar
> else
> echo "You do not have Permission to Install to this System"
> exit
> endif
>
> On 2020-06-27 12:11, Rick Ulland wrote:
> > shell 2.1 does what you want
> >
> > if *test* then *statements* else *statements* endif
> >
> > where test is
> > -y one char from stderr y=TRUE n=FALSE
> > -f path true if file exists
> > -r path true if file exists readable
> > -w path true if file exists writeable
> > -e path true if file exists and is execable
> > -d path true if file exists and is a directory
> >
> > Luck!
> >
> > -ricku
> > CoNect
> >
> >
> > On 6/27/20 10:58 AM, coco at jechar.ca wrote:
> >>
> >> I want to make a script that will create some directorys and
> >> then do other things in those directorys. The problem is that
> >> maybe these directorys already exist causing the script to
> >> end prematurely with ERROR 218.
> >>
> >> I am running shell_21.
> >>
> >> Is there any way to tell the script just ignore errors and go to
> >> the next instruction anyway or is there a command or utility to
> >> test for the existence of a directory and allowing for conditional
> >> execution.
> >>
> >> Charlie
> >>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
More information about the Coco
mailing list