shellscript

Parameter

variable Set and Not Null Set But Null Unset
${parameter:-word} substitute parameter substitute word substitute word
${parameter-word} substitute parameter substitute null substitute word
${parameter:=word} substitute parameter assign word assign word
${parameter=word} substitute parameter substitute null assign word
${parameter:?word} substitute parameter error, exit error, exit
${parameter?word} substitute parameter substitute null error, exit
${parameter:+word} substitute word substitute null substitute null

Parameter Expansion

  • Case modification
    • ${var^}
    • ${var^^}
    • ${var,}
    • ${var,,}
    • ${var~}
    • ${var~~}

Reference


written by keyolk on 23/07/2018
comments powered by Disqus