-------------------------------------------------------------------------------- special parameters: $* $@ -------------------------------------------------------------------------------- $, $@ .. all text past the command are treated as positional parameters (separated by tab or space) # # I. Use of $* and $@ # $ cat looping1 #!/bin/bash # code to test how bash interprets $*, $@, $S*" and "$a" for file in $* do echo $file done $ ./looping1 a b a b $ ./looping1 a b a b $ ./looping "a" "b" a b $ ./looping "hello kitty" b #for '$*' hello kitty b Identical result for if $* is replaced by $@ # # II. Now we use quotes: "$*" and "$@" # $ ./looping "hello kitty" b for "$*" hello kitty b #treats all the parameters as one line $ ./looping "hello kitty" b #for "$@" hello kitty #treats quoted text and ordinary text as parameters b # # III. Expansion # $ ./looping *.txt #the shell expands, subsitutes before passing text to rprogram a.txt b.txt and so on Conclusion: if you have files which have spaces in them then you should use "$@" (probably the safe choice).