*
从一个开始扩展到位置参数.当...的时候
扩展出现在双引号内,它扩展为一个单词
每个参数的值由的第一个字符分隔
IFS特殊变量.也就是说,"$ *"等效于"$ 1c $ 2c…",
其中c是IFS变量值的第一个字符.如果
IFS未设置,参数用空格分隔.如果IFS为空,
这些参数是在不插入分隔符的情况下进行连接的.
Expands to the positional parameters, starting from one. When the
expansion occurs within double quotes, it expands to a single word
with the value of each parameter separated by the first character of
the IFS special variable. That is, "$*" is equivalent to "$1c$2c…",
where c is the first character of the value of the IFS variable. If
IFS is unset, the parameters are separated by spaces. If IFS is null,
the parameters are joined without intervening separators.
@
从一个开始扩展到位置参数.当...的时候
扩展出现在双引号内,每个参数扩展为一个
单独的单词.也就是说,"$ @"等效于"$ 1""$ 2"…….如果
双引号扩展发生在一个词内,扩展
第一个参数与原始文件的开头部分结合在一起
单词,最后一个参数的扩展与最后一个连接
原始单词的一部分.如果没有位置参数,
"$ @"和$ @扩展为空(即它们被删除了).
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" …. If the
double-quoted expansion occurs within a word, the expansion of the
first parameter is joined with the beginning part of the original
word, and the expansion of the last parameter is joined with the last
part of the original word. When there are no positional parameters,
"$@" and $@ expand to nothing (i.e., they are removed).
一个更好的例子:
$ d=(a b c)
$ for i in "${d[*]}"; do echo $i; done <---- it is a field all together
a b c
$ for i in "${d[@]}"; do echo $i; done <---- each item is a different field
a
b
c