STACK="${2:-}"
shift
;;
What does the following code mean in shell script?
Specifically what does ${2:-}
mean? Looks like it is assigned to a variable.
STACK="${2:-}"
shift
;;
What does the following code mean in shell script?
Specifically what does ${2:-}
mean? Looks like it is assigned to a variable.
${2:-}
means, if the 2nd
parameter is unset or null, empty will be assigned to it.
Eg:
$ a= # passed empty to a
$ echo $a # prints empty or nothing
$ echo ${a:-test} # prints test
test