26

I have a bash code export TM_SCALAC=${TM_SCALAC:-scalac}.

I'm not sure the meaning of ":-" inside the ${}. How do I interpret this line of bash code?

prosseek
  • 8,558

1 Answers1

28

That means if TM_SCALAC isn't already set, set it to "scalac".

From bash reference manual:

3.5.3 Shell Parameter Expansion

...

${parameter:-word} If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.

jlliagre
  • 61,204