Test and content replacement of shell variables, replacement of shell Variables
 
Reference: laruence's private house dish-Linux BASICS (Third edition).
 
In Chapter 11th of the Linux BASICS (Third edition, the final example illustrates '-', '=', and ','? 'Usage of three special symbols.
 
After reading these routines, I feel like var =$ {str-newvar}, var =$ {str = newvar}, or var =$ {str? Is the replacement of the newvar} variable the only three-object operator in the C language? The usage is similar:
 
Max = (x> y )? (X: y ). The analysis is as follows:
 
Var =$ {str-newvar}: If str does not exist, var = newvar; // select the latter
 
If str exists, var =$ {str}; // select the former
 
Similarly, "=" can be explained as follows:
 
 
Var =$ {str = newvar}: If str does not exist, var = newvar; // select the latter, but str = newvar because it is an equal sign;
 
If str exists, var =$ {str}; // select the former str to keep the original content.
 
 
For "?" Is interpreted as"
 
 
Var =$ {str? None of the variables}: If str does not exist, an error is returned: none of the variables; // select the latter
 
If str exists, var =$ {str}; // select the former str to keep the original content.