bash – $@和“$@”之间有什么区别吗?
参见英文答案 >
Accessing bash command line args $@ vs $*4个
$@和“$@”之间有什么区别吗? 我知道非特殊字符可能存在差异,但带有输入参数的@符号呢?
是!
$cat a.sh echo "$@" echo $@ 我们来运行吧: $./a.sh 2 "3 4" 5 2 3 4 5 # output for "$@" 2 3 4 5 # output for $@ -> spaces are lost! 正如您所看到的,使用$@会使参数在用作参数时“丢失”某些内容.有关详细说明,请参见-for-example- I just assigned a variable,but echo $variable shows something else. 从GNU Bash manual –> 3.4.2 Special Parameters开始:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |