Bash basic concepts
http://wiki.bash-hackers.org/scripting/basics
Bash script parameter substitution
http://tldp.org/LDP/abs/html/parameter-substitution.html
# This is a variation on indirect reference, but with a * or @.
# Bash, version 2.04, adds this feature.
xyz23=whatever
xyz24=
a=${!xyz*} # Expands to *names* of declared variables
# ^ ^ ^ + beginning with "xyz".
echo "a = $a" # a = xyz23 xyz24
a=${!xyz@} # Same as above.
echo "a = $a" # a = xyz23 xyz24
echo "---"
abc23=something_else
b=${!abc*}
echo "b = $b" # b = abc23
c=${!b} # Now, the more familiar type of indirect reference.
echo $c # something_else
|
| from 鳥哥 |
沒有留言:
張貼留言