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

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

问题描述

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

例如:

  umbrella_corp_options $ @


解决方案

$ @是所有传递给脚本的参数。举例来说,如果你调用 ./ someScript.sh富栏然后 $ @ 将等于富栏

如果你这样做:

  ./ someScript.sh富巴

,然后在 someScript.sh 引用:

  umbrella_corp_options$ @

这将被传递到 umbrella_corp_options 用双引号括起来每个参数,允许采取与空白参数从呼叫者并传递。

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

For example:

umbrella_corp_options $@

解决方案

$@ is all of the parameters passed to the script. For instance, if you call ./someScript.sh foo bar then $@ will be equal to foo bar.

If you do:

./someScript.sh foo bar

and then inside someScript.sh reference:

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天全站免登陆