Specify command line arguments like name=value pairs for shell script

前端 未结 5 1157
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-10 07:38

Is it possible to pass command line arguments to shell script as name value pairs, something like

myscript action=build module=core

and th

5条回答
  •  误落风尘
    2020-12-10 08:37

    env action=build module=core myscript
    

    You said you're using tcsh. For Bourne-based shells, you can drop the "env", though it's harmless to leave it there. Note that this applies to the shell from which you run the command, not to the shell used to implement myscript.

    If you specifically want the name=value pairs to follow the command name, you'll need to do some work inside myscript.

提交回复
热议问题