[Coco] OS9 Script Error Handling or File Testing ?

coco at jechar.ca coco at jechar.ca
Sat Jun 27 19:22:29 EDT 2020


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
>> 


More information about the Coco mailing list