gwang@gwang-d2:~/study/shtest$ set "a b" c
gwang@gwang-d2:~/study/shtest$ echo $1
a b
gwang@gwang-d2:~/study/shtest$ echo $2
c
gwang@gwang-d2:~/study/shtest$ echo $@
a b c
gwang@gwang-d2:~/study/shtest$ echo $*
a b c
gwang@gwang-d2:~/study/shtest$ echo "$@"
a b c
gwang@gwang-d2:~/study/shtest$ echo "$*"
a b c
如果没有双引号,$@与$*是一样的。
gwang@gwang-d2:~/study/shtest$ for i in $@; do echo $i; done
a
b
c
gwang@gwang-d2:~/study/shtest$ for i in $*; do echo $i; done
a
b
c
如果加上双引号,$@与$*就不一样了:
gwang@gwang-d2:~/study/shtest$ for i in "$*"; do echo $i; done
a b c
gwang@gwang-d2:~/study/shtest$ for i in "$@"; do echo $i; done
a b
c
阅读(1075) | 评论(0) | 转发(0) |