shell之变量替换:临时替换
${FILE:-word} 若变量为空,给变量FILE添加一个临时默认值word,FILE本身值并不变化
eg:
eg:
FILE1=${FILE:-word} 若FILE为空,则赋予FILE1值word
${FILE:+word} 若变量不为空,给变量添加一个临时默认值word,FILE本身值并不变化
eg:
eg:
FILE1=${FILE:+word} 若FILE不为空,则赋予FILE1值word
${FILE:=word} 若变量为空,给变量FILE添加一个永久默认值word
eg:
: ${FILE:=word} 若变量为空,则赋予FILE值word
${FILE:?word} 若变量为空,输出错误信息word
[星空刺]
|-->一颗星辰一闪即逝,支撑它的唯有方向和目的