In shell scripts we use
export VAR1=${VAR1:-KK}
export DATE=${DATE:=$(cat ${DATEDIR}/today_date)}
I have seen this in many scripts.
From the Parameter expansion
section of the bash
man page:
${parameter:-word} Use Default Values. If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.
${parameter:=word} Assign Default Values. If parameter is unset or null, the expansion of word is assigned to parameter. The value of parameter is then substituted. Positional parameters and special parameters may not be assigned to in this way.
There are many other options during parameter expansion, see the man page for all of them.