I need to install a product for Linux that comes with an install.sh
script. Before running it I want to understand what it will do to my system. At the very begin of the script there is something like VARIABLE="${VARIABLE:-""}"
. I know ${VARIABLE}
is reference to access the content of the variable VARIABLE
. But I really don't know the purpose of :-""
Can you help me please?
Asked
Active
Viewed 32 times
0

Jens
- 69,818
- 15
- 125
- 179
-
1`${var:-other}` set to `var` if `var` is set, otherwise the default `other` is used.. So `v1="${v2:-""}"` set `v1=v2` if `v2` is set, otherwise it sets `v1=""`. Think about how you can set a default or use the first program argument `$1`. `myvar="${1:-some_default}"`. – David C. Rankin Feb 20 '22 at 08:33
-
For all the variable operators, see https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash/16753536#16753536 – Jens Feb 20 '22 at 08:36
-
See: [shell parameter expansion](https://www.gnu.org/software/bash/manual/bash.html#Shell-Parameter-Expansion) – JRFerguson Feb 20 '22 at 13:23