- 高级变量赋值
[umpay@ansible-host check_sub]$ title=ceo
[umpay@ansible-host check_sub]$ name=${title-mage}
[umpay@ansible-host check_sub]$ echo $name
ceo
[umpay@ansible-host check_sub]$ title=
[umpay@ansible-host check_sub]$ name=${title-mage}
[umpay@ansible-host check_sub]$ echo $name
[umpay@ansible-host check_sub]$ unset title
[umpay@ansible-host check_sub]$ name=${title-mage}
[umpay@ansible-host check_sub]$ echo $name
mage
[umpay@ansible-host check_sub]$ title=ceo
[umpay@ansible-host check_sub]$ name=${title:-mage}
[umpay@ansible-host check_sub]$ echo $name
ceo
[umpay@ansible-host check_sub]$ title=
[umpay@ansible-host check_sub]$ name=${title:-mage}
[umpay@ansible-host check_sub]$ echo $name
mage
- 变量间接引用
eval 命令
[umpay@ansible-host ~]$ n=10
[umpay@ansible-host ~]$ echo {0..$n}
{0..10}
[umpay@ansible-host ~]$ eval echo {0..$n}
0 1 2 3 4 5 6 7 8 9 10
[umpay@ansible-host ~]$ n=10
[umpay@ansible-host ~]$ b=`echo {0..$n}`
[umpay@ansible-host ~]$ echo $b
{0..10}
[umpay@ansible-host ~]$ eval echo $b
0 1 2 3 4 5 6 7 8 9 10
标签:sub,umpay,title,高级,host,ansible,Linux,check,变量
From: https://www.cnblogs.com/baixisuozai/p/18151358