Set default values for variables in the shell

  • b variable is nullthe time,var=a
var=${b-a}
  • When the b variable is NULLan empty string,var=a
var=${b:-a}

Note that when the variable is ${1-9}time, there is no second case


Special meaning

  • $$ current shell process id
  • $0 Current script file name
  • $# The number of parameters passed to the function or script
  • ∗ or *or or @ All parameters passed to the function or script, "KaTeX parse error: Undefined control sequence: \* at position 1: \̲*̲" returns a string, "@" returns a list
  • $? The exit status of the last command or the return value of the function

Reference link: http://c.biancheng.net/cpp/view/2739.html

Guess you like

Origin blog.csdn.net/jjt_zaj/article/details/113053480