Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将参数传递给我需要使用'/bin/bash'调用的myscript.sh,如下所示
/bin/bash -c myscript.sh
./myscript.sh arg1 arg2 arg3
或者
/bin/bash myscript.sh arg1 arg2 arg3
(您不需要该-c选项)
-c
在脚本中,您可以通过以下方式检索它们:
var1=$1 var2=$2