How to handle passing filenames with spaces and wildcards int o bash scripts?

Styma, Robert E (Robert) stymar at lucent.com
Wed Mar 1 21:56:06 UTC 2006


Thanks in advance for any hints/help/pointers/tricks that you can provide. 
/Mike

Try using $@ in place of $*

For example, consider the script:
echo $#
echo $@

for i in "$@"
do
echo $i
done

######################

say the script was called /tmp/zzzz

run /tmp/zzzz  test1  test2 "test3 test4"
$# should be 3
and the output should be
test1
test2
test3 test4

Hope this helps




More information about the fedora-list mailing list