1
[email protected]
和$*
有什么区别?为什么它们具有相同的值,但当我将IFS
设置为|
时,"[email protected]"
和"$*"
是不同的?
[email protected]
和$*
有什么区别?为什么它们具有相同的值,但当我将IFS
设置为|
时,"[email protected]"
和"$*"
是不同的?
[email protected]
和$*
的区别:(!不这样做)未上市,没有在所有的:都等于$1 $2
....加上双引号,[email protected]
每个元素扩展作为参数:$1
$2
...而$*
扩展为合并为一个参数的所有元素:$1c$2c...
(其中c是IFS的第一个字符)。你几乎总是想要[email protected]
。阵列也是如此:${myarray[@]}