In a bash script I cannot post here I see the following expression:


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?

1 Answer 1


This is the same as


with OTHERVAR being equal to -x. In other words, if MYVAR is unset or null, substitute null; otherwise, substitute -x.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .