I've inherited some bash scripts and I see this one liner
ENV_NAME=${1:-develop}
Can someone tell me what it's doing? I don't even know how to google this.
Thanks!
I've inherited some bash scripts and I see this one liner
ENV_NAME=${1:-develop}
Can someone tell me what it's doing? I don't even know how to google this.
Thanks!
The construct is a so called parameter expansion. It expands to a default value if the variable itself is not set or null. The semantic is
${variable:-default value}
$1
is the first parameter passed to the script. If the parameter will be omitted ENV_NAME
defaults to "develop"
.