我的代码:
#!/bin/bash for i in $@; do echo $i; done;
运行脚本:
# ./script 1 2 3 1 2 3
所以,我想跳过第一个参数,得到:
# ./script 1 2 3 2 3
使用偏移参数扩展
原文链接:https://www.f2er.com/bash/386320.html#!/bin/bash for i in "${@:2}"; do echo $i done
例
$func(){ for i in "${@:2}"; do echo "$i"; done;}; func one two three two three