${varname:-word}
If varname exists and is not nil, returns the value of VarName, otherwise returns word. This is commonly used to return a default value when VarName is undefined
${varname:=word}
If varname exists and is not nil, return the value of varname, otherwise set the value of varname to Word and return the value. This is used to set default values for variables
${varname:?message}
If varname exists and is not nil, then return the value of varname, otherwise print varname:message, and interrupt the script (only established under non-interactive shell)
${varname:+word}
If VarName is present and is not nil, return to Word, otherwise nil
${varname:offset:length}
Starting with offset, the length of the substring is truncated, where the sequence number of the string is calculated from 0, there are several special cases:
1 if length is not specified, it is truncated to the end of the entire string
2 If offset is negative, the number of offset characters from the end of the string is followed, and the length is truncated, and if length is not specified, it is truncated to the end of the entire string, such as:
Name=-3:2-3} output def
It is important to note that there is a space between this and: to let the shell differentiate ${varname:-word} form
3 if VarName is * or @, then it is starting from the first offset position parameter, intercept length, if not specified length, then it is intercepted to the last position parameter
${varname#pattern}
Match from the beginning of the varname, then delete the shortest match and return the remaining string
${varname# #pattern}
Start the match from the beginning of the varname, and then delete the longest match, returning the remaining string
${varname%pattern}
Matches from the end of the varname, and then deletes the shortest match, returning the remaining string
${varnam%%pattern}
Matches from the end of the varname, and then deletes the longest match, returning the remaining string
${varname/pattern/string}
Replaces the first longest occurrence with a string, or if the string is nil, deletes the match
${varname//pattern/string}
Replaces all the longest occurrences with a string, or if the string is nil, deletes the match
In the above two substitution modes, if pattern starts with #, the match starts with varname, and if varname is * or @, then the substitution is done sequentially for each position parameter.
The shell string operator