Passing parameters to a Bash function

前端 未结 7 1186
北荒
北荒 2020-11-22 10:15

I am trying to search how to pass parameters in a Bash function, but what comes up is always how to pass parameter from the command line.

I would like to pass param

7条回答
  •  逝去的感伤
    2020-11-22 10:37

    Miss out the parens and commas:

     myBackupFunction ".." "..." "xx"
    

    and the function should look like this:

    function myBackupFunction() {
       # here $1 is the first parameter, $2 the second etc.
    }
    

提交回复
热议问题