How to get the nth positional argument in bash?

后端 未结 4 1454
傲寒
傲寒 2020-12-07 13:03

How to get the nth positional argument in Bash, where n is variable?

4条回答
  •  粉色の甜心
    2020-12-07 13:46

    As you can see in the Bash by Example, you just need to use the automatic variables $1, $2, and so on.

    $# is used to get the number of arguments.

提交回复
热议问题