[Coco] OS9 Script Error Handling or File Testing ?
coco at jechar.ca
coco at jechar.ca
Sun Jun 28 11:00:14 EDT 2020
I could try
echo > /dd/cmds/testifIcanWrite
if -w /dd/cmds/testifIcanWrite
then
del /dd/cmds/testifIcanWrite
cd /dd/cmds
ar -x /path/to/proramarchive
else
echo You don't have permission to install.
ex
endif
Problem is if "echo > /dd/cmds/te .. "
fails the program stops there and I never
get the message
You don't have permission to install.
Is there a way that I can tell a shell script
to not end on an error but just to ignore
the error and continue to the next command ?
On 2020-06-28 03:07, Jeff Teunissen wrote:
> 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