shift: shift [n]
The positional parameters from $N+1 ... are renamed to $1 ... If N is not given, it is assumed to be 1.
shift 4会将原来的$5变为$1
6.sh内容如下
echo \$1
shift
echo \$1
./6.sh 8 7
输出为
8
7
shift: shift [n]
The positional parameters from $N+1 ... are renamed to $1 ... If N is not given, it is assumed to be 1.
shift 4会将原来的$5变为$1
6.sh内容如下
echo \$1
shift
echo \$1
./6.sh 8 7
输出为
8
7
本文标题:shift命令
本文链接:https://www.haomeiwen.com/subject/umavahtx.html
网友评论