[Coco] stupid question, but the manual doesn't say

Robert Gault robert.gault at att.net
Fri Apr 18 22:14:38 EDT 2014


Wayne Campbell wrote:
> I have a shell script that I want to pass a value to. If I type the
> script-file name and press enter, then enter the value I want, everything
> is good, but if I type the script-file name with the value as a parameter,
> I get a bad pathname error (215). To recap:
>
> OS9:script-file
> value
>
> works.
>
> OS9:script-file value
>
> bad pathname
>
> What is the correct form? Below is my script-file.
>
> var.1
> del %1Raw.txt
> del %1Lines.txt
> del %1Vars.txt
> del %1VDT.txt
> del %1DSAT.txt
> del %1.B09
>
> Wayne
>

I've not done any testing with the above but the script does not look quite right.

Suppose that Value is the name of a file, as that seems the only thing that 
would make sense, and that value was FileName. Now suppose the script becomes
del FileNameRaw.txt
del FileNameLines.txt
...
del FileName.B09
The only line that immediately seems legal is the last one.

In any case, when I have created scripts that need input, I have a line with a 
prompt which asks for the input, waits for an entry with a CR, and assigns the 
entry to a variable.
I've had to write my own prompt (the current one in NitrOS-9 won't work for my 
purpose) but I use mine as:
prompt2 echo Ask some question? ;var.1
Phrase the prompt so you will be sure of what a user will enter so that
del %1Raw.txt
is a legal OS-9 command.

Robert




More information about the Coco mailing list