Bash中的$@是什么?

前端之家收集整理的这篇文章主要介绍了Bash中的$@是什么?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > What does $@ mean in a shell script?5个答案我认为shell脚本中的句柄$ @是给出脚本的所有参数的数组。这是真的?

我问,因为我通常使用搜索引擎收集信息,但我不能谷歌的$ @,我已经增长太自定义,以轻松获得服务的一切。

是。请参阅特殊参数下的bash手册页(您首先要去的)

Special Parameters

The shell treats several parameters specially. These parameters may only be referenced; assignment to them is not allowed.

* 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.

@ Expands to the positional parameters,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).

原文链接:https://www.f2er.com/bash/387791.html

猜你在找的Bash相关文章