有没有什么简单的方法可以将命名参数传递(接收)给 shell 脚本?
例如,
my_script -p_out '/some/path' -arg_1 '5'
Run Code Online (Sandbox Code Playgroud)
并在内部my_script.sh
将它们接收为:
# I believe this notation does not work, but is there anything close to it?
p_out=$ARGUMENTS['p_out']
arg1=$ARGUMENTS['arg_1']
printf "The Argument p_out is %s" "$p_out"
printf "The Argument arg_1 is %s" "$arg1"
Run Code Online (Sandbox Code Playgroud)
这在 Bash 或 Zsh 中可能吗?