January 2001
Intermediate to advanced
480 pages
7h 22m
English
Variable values can be accessed and manipulated using variable expansion. Basic expansion is done by preceding the variable name with the $ character. Other types of expansion can be used to return portions or the length of variables, use default or alternate values, assign default or alternate values, and more.
| ${variable} | value of variable |
| ${#variable} | length of variable |
| ${variable:–word} | value of variable if set and not null, else print word. If: is omitted, variable is only checked if it is set. |
| ${variable:=word} | value of variable if set and not null, else variable is set to word, then expanded. If: is omitted, variable is only checked if it is set. |
| ${variable:?} | value of variable if set and not null, ... |
Read now
Unlock full access