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?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityThat 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.
:-
mean in a shell script