You can "slice" arrays in bash; instead of using shift
, you might use
for i in "${@:2}"
do
echo "$i"
done
$@
is an array of all the command line arguments, ${@:2}
is the same array less the first element. The double-quotes ensure correct whitespace handling.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…