Georg Baum wrote:
> From the bash manpage, section "Special Parameters":
> 
> @      Expands to the positional parameters, starting from one. 
> When the expansion occurs within double quotes, each parameter
> expands to a separate
> word. That is, "$@" is equivalent to "$1" "$2" ...  When there are
> no positional parameters, "$@" and $@ expand to nothing (i.e., they
> are removed).
> 
> If the arguments are "a" "b b" "c", for arg in $@ expands to the
> four tokens a b b c. for arg in "$@" expands to the three tokens "a"
> "b b" "c". I don't know if this is POSIX behaviour or bash specific.

Ok, understood. This is POSIX and has some quite complicated name. I
use it myself often:

echo "${FOO}" | sed '...'

will preserve any '\n' in ${FOO} so that sed acts on each line in
turn. In contrast,

echo ${FOO} | sed '...'

presents the entire string to sed as a single entity.

-- 
Angus

Reply via email to