How to access command line arguments of the caller inside a function?

后端 未结 8 858
囚心锁ツ
囚心锁ツ 2020-11-28 07:31

I\'m attempting to write a function in bash that will access the scripts command line arguments, but they are replaced with the positional arguments to the function. Is ther

8条回答
  •  北海茫月
    2020-11-28 08:14

    #!/usr/bin/env bash
    
    echo name of script is $0
    echo first argument is $1
    echo second argument is $2
    echo seventeenth argument is $17
    echo number of arguments is $#
    

    Edit: please see my comment on question

提交回复
热议问题