mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 17:41:41 +00:00
Add indirect expansion in bash.html.markdown
This commit is contained in:
parent
55ad60b7dd
commit
6955861bba
@ -88,6 +88,11 @@ echo ${Variable: -5} # => tring
|
|||||||
# String length
|
# String length
|
||||||
echo ${#Variable} # => 11
|
echo ${#Variable} # => 11
|
||||||
|
|
||||||
|
# Indirect expansion
|
||||||
|
OtherVariable="Variable"
|
||||||
|
echo ${!OtherVariable} # => Some String
|
||||||
|
# This will expand the value of the OtherVariable
|
||||||
|
|
||||||
# Default value for variable
|
# Default value for variable
|
||||||
echo ${Foo:-"DefaultValueIfFooIsMissingOrEmpty"}
|
echo ${Foo:-"DefaultValueIfFooIsMissingOrEmpty"}
|
||||||
# => DefaultValueIfFooIsMissingOrEmpty
|
# => DefaultValueIfFooIsMissingOrEmpty
|
||||||
|
Loading…
Reference in New Issue
Block a user