mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Clear explanation of default value expression
This commit is contained in:
parent
7f1c4293e4
commit
6848f45ebe
@ -64,7 +64,8 @@ echo ${VARIABLE:0:7}
|
|||||||
|
|
||||||
# Default value for variable
|
# Default value for variable
|
||||||
echo ${FOO:-"DefaultValueIfFOOIsMissingOrEmpty"}
|
echo ${FOO:-"DefaultValueIfFOOIsMissingOrEmpty"}
|
||||||
# This works for null (FOO=), empty string (FOO=""), zero (FOO=0) returns 0
|
# This works for null (FOO=) and empty string (FOO=""); zero (FOO=0) returns 0.
|
||||||
|
# Note that it only returns default value and doesn't change variable value.
|
||||||
|
|
||||||
# Builtin variables:
|
# Builtin variables:
|
||||||
# There are some useful builtin variables, like
|
# There are some useful builtin variables, like
|
||||||
|
Loading…
Reference in New Issue
Block a user