您的位置:首页 > 运维架构 > Shell

shell脚本变量的参数

2017-05-24 21:33 281 查看
https://stackoverflow.com/questions/5163144/what-are-the-special-dollar-sign-shell-variables

mkdir folder && cd $_ (创建一个目录,并且立马切换到这个目录里面去。)

$1
,
$2
,
$3
, ... are the positional parameters.

"$@"
is an array-like construct of all positional parameters,
{$1, $2, $3 ...}
.

"$*"
is the IFS expansion of all positional parameters,
$1 $2 $3 ...
.

$#
is the number of positional parameters.

$-
current options set for the shell.

$$
pid of the current shell (not subshell).

$_
most recent parameter (or the abs path of the command to start the current shell immediately after startup).

$IFS
is the (input) field separator.

$?
is the most recent foreground pipeline exit status.

$!
is the PID of the most recent background command.

$0
is the name of the shell or shell script.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: