I have seen the following usage of script.
export CONFIG=${X_CONFIG:-${Y_CONFIG}}
Question> what is the real meaning of this script?
Thank you
I have seen the following usage of script.
export CONFIG=${X_CONFIG:-${Y_CONFIG}}
Question> what is the real meaning of this script?
Thank you
${X_CONFIG:-${Y_CONFIG}}}
is a parameter expansion for a default value.
That is to say: It expands to the value of X_CONFIG
if set to a non-null value, or Y_CONFIG
if X_CONFIG
was either unset or null.
Thus, the effect of the statement as a whole is to assign a variable CONFIG
to have an identical value to either $X_CONFIG
or $Y_CONFIG
, and export that variable to the environment.