> Doesn't work very well if 'command' then passes $1 to another program.
Actually it works fine under bash.
Try this:
blah1:
#!/bin/bash
# blah1: echoes its input arguments, one on each line.
# i.e ./blah1 "one" "two" "this is line three"
# -- will produce three lines of output
for a
do
echo $a
done
blah2:
#!/bin/bash
# blah2: calls blah1 with the first five arguements given to it
./blah1 "$1" "$2" "$3" "$4" "$5"
Now create some files with spaces:
"file 1 with spaces"
"file 2 with spaces"
"file 3 with spaces"
Then run ./blah2 *
The problem comes if a given script isn't careful to make a single
argument to it, with spaces or otherwise, a single argument to its child
process. If there were no quotes around the "blah1" line in "blah2" bash
would break up the arguments at the spaces. Quoting fixes this.
Yes, this is something you have to be aware of when writing shell scripts.
Andrwe
--------------------------------------------------------------------
http://www.lug.org.uk http://www.linuxportal.co.uk
http://www.linuxjob.co.uk http://www.linuxshop.co.uk
--------------------------------------------------------------------