What does the expression ${MYVAR:+-x} mean in bash?
6,190
This is the same as
${MYVAR:+OTHERVAR}
with OTHERVAR
being equal to -x
. In other words, if MYVAR
is unset or null, substitute null; otherwise, substitute -x
.
References
Related videos on Youtube
Author by
user3185306
Updated on September 18, 2022Comments
-
user3185306 over 1 year
In a bash script I cannot post here I see the following expression:
${MYVAR:+-x}
I understand the meaning of expressions like
${MYVAR:+OTHERVAR}
and${MYVAR:-OTHERVAR}
, but an expression with both a plus-sign and a minus-sign. What does it mean, if anything?