shift命令
2020-05-26 本文已影响0人
mirroru
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