I’m looking through someone else’s code and am not sure what this means. It is either a variable call VARIABLE+set which is a strange variable name since is has a +, or is is evaluated and is hard to Google because it has ${} in it 😉
I’m looking through someone else’s code and am not sure what this means. It
Share
It took be some time, but I found a link explaining what this does. It is a form of bash parameter-substitution that will evaluate to
"set"if$VARIABLEhas been set and null otherwise. This allows you to check if a variable is set by doing the following:It is also interesting to note that
${VARIABLE+set}can just as easily be${VARIABLE+anything}. The only reason for using +set is because it is slightly more self-documenting (although not enough to keep me from asking this question).