Substitution of 1,shell variables
Variables can be replaced by a specific value depending on whether the variable is empty or deleted
${var} variable Original value
$ (Var:-word) If the variable is empty or has been deleted then return to Word, but do not change the value of Var
Name= "Xiaoming"
echo "Xiaoming ' s Age is ${age:-12}"
Ech "age = ${age}"
>>>>>>>>
Xiaoming ' s age is 12
Age =
>>>>>>>
$ (Var:=word) If the variable is empty or has been deleted then return to Word and change the value of Var
Name= "Xiaoming"
age=11
echo "Xiaoming ' s Age is ${age:+12}"
Ech "age = ${age}"
>>>>>>>>
Xiaoming ' s age is 12
Age = 12
>>>>>>
$ (Var:?word) If the variable is empty or has been deleted then return to Word, then send the message to the standard error output
Name= "Xiaoming"
echo "Xiaoming ' s Age is ${age:-12}"
Ech "age = ${age}"
>>>>>>>>
./hello.sh: Line 8:age:12
>>>>>>>
$ (Var:+word) If VAR is defined, then return to word, but do not change the value of Var
Example
Name= "Xiaoming"
age=11
echo "Xiaoming ' s Age is ${age:=12}"
Ech "age = ${age}"
>>>>>>>>
Xiaoming ' s age is 12
Age = 11
>>>>>>>
2, command substitution means that the shell can perform a command save and then output it in the appropriate place
Lll= ' ls ' note here is the anti-quote, not single quote
Echo ${lll}
3, escape character
\ \ counter Slash
\a Alarm Ringing
\b Backspace (delete key)
\f Page Change
\ nthe line break
\ r Enter
\ t Horizontal tab
\w Vertical Tab
Substitution of shell variables, command substitution, escape character