Iterate through parameters skipping the first

前端 未结 5 1951
野的像风
野的像风 2020-12-24 02:25

Hi i have the following:

bash_script parm1 a b c d ..n

I want to iterate and print all the values in the command line starting from a, not

5条回答
  •  执笔经年
    2020-12-24 02:44

    Another flavor, a bit shorter that keeps the arguments list

    shift
    for i in "$@"
    do
      echo $i
    done
    

提交回复
热议问题