$@ 在 shell 脚本中是什么意思? [英] What does $@ mean in a shell script?

查看:43
本文介绍了$@ 在 shell 脚本中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

美元符号后跟 at 符号 (@) 在 shell 脚本中是什么意思?

What does a dollar sign followed by an at-sign (@) mean in a shell script?

例如:

umbrella_corp_options $@

推荐答案

$@ 是传递给脚本的所有参数.

$@ is all of the parameters passed to the script.

例如,如果您调用 ./someScript.sh foo bar 那么 $@ 将等于 foo bar.

For instance, if you call ./someScript.sh foo bar then $@ will be equal to foo bar.

如果你这样做:

./someScript.sh foo bar

然后在 someScript.sh 里面引用:

umbrella_corp_options "$@"

这将被传递给 umbrella_corp_options,每个单独的参数用双引号括起来,允许从调用者那里获取带有空格的参数并将它们传递.

this will be passed to umbrella_corp_options with each individual parameter enclosed in double quotes, allowing to take parameters with blank space from the caller and pass them on.

这篇关于$@ 在 shell 脚本中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆