Stringing Commands
16 messages in this thread
Is there a way to string commands in AmigaDOS like you can in Unix? For
example, under Unix I can type pwd;ls;cd;clear at one time and the commands
will be executed sequentially. How can this be done on the Amiga? Thanks.
Yup…They sure can. Just type the command and then type a control-J
character instead of hitting a return between commands. When you've typed
the last command, type return and all the commands will be executed.
Steve
Thanks Steve, Will this work with script files as well?
Tim
Do you mean within scripts? I'm not sure what purpose that would
serve…
If you mean just executing script files one after another, yes it will.
Steve
Tim,
as far as I can tell, even with aliases, you cannot embed multiple
commands, with the exception of backtick "`" commands, on a single line in
AmigaDOS. AmigaDOS, for some reason, uses the semicolon, ";", character
for comments.
As it stands, you have two choices. Either give up multiple commands,
or use a shell replacement such as CShell (scan the listings on CSH*, a
C-Shell type replacement & my personal choice) or SKShell (a Korn-Shell
replacement).
I hope this helps.
Brian
In addition to the control J method mentioned, you can also use the RUN
command, and the + key, ie
run list + dir + delete #? + echo "oops"
The commands strung together won't be executed until the first one without the
trailing + sign.
andy
Andy,
cute!
Brian
Andy, I tried the example you gave but it didn't work. I got two errors:
No information for "+": object not found list failed returncode 20
Am I missing something here? Thanks.
Maybe my message was reformatted.
Each command must be on a line of its own. The + sign must be the last thing
on each line. so its The run command starts the whole thing off.
So lets see if I can get this example across:
run list +
dir +
echo "done"
This will do a list, then a dir, then echo "done"
andy
BTW, this is occasionally useful in a script file. (no, really 🙂 )
I usually use it to combine a WAIT and another command, like:
run WAIT until 20:00 +
say "Go Home"
andy
That's what 'cron' is for!
Yes. I find it amusing that you can implement a cron-type program out of
script files. I've got a fairly complete cron-as-a-script somewhere around,
which I did for fun.
andy
I tried that on my PC but it wouldn't do anything else until the event had
passed… 🙂
Well, you probably haven't upgraded to a Pentium yet. 🙂
andy
Thanks Andy. Yes, your original example was formatted as one line. I tried
your second one and it works. Thanks.