在 shell 脚本中,以下是什么意思?
OVERRIDE="-Dplan.override $2"
我们是否将程序的第二个参数的值分配给OVERRIDE
变量并创建一个plan.override
值为 的新环境变量OVERRIDE
?
You are creating a new variable OVERRIDE with the content -Dplan.override $2
- $2
stands for the second argument your shell script was given. The variable is only usable within your shell script, not outside of it.
Example:
$ ./your-script.sh firstarg secarg
-> OVERRIDE will have the value -Dplan.override secarg
If you want to make OVERRIDE global, use export in your script:
export OVERRIDE="-Dplan.override $2"
Then source your script from your shell, like
$ source your-script.sh firstarg secarg
Then your variable OVERRIDE is globally available:
$ echo $OVERRIDE
-Dplan.override secarg