How to pass an array to a bash function

后端 未结 3 1849
后悔当初
后悔当初 2021-02-05 16:55

How do I pass an array to a function, and why wouldn\'t this work? The solutions in other questions didn\'t work for me. For the record, I don\'t need to copy the array so I don

3条回答
  •  情书的邮戳
    2021-02-05 17:24

    ar is not the first parameter to test - It is all the parameters. You'll have to echo "$@" in your function.

提交回复
热议问题