The shell script has strict rules for spaces, and there must be no spaces on either side of an assignment statement, and a string comparison with spaces on both sides of the equal sign
When assigning: I=1
i=$ ((i+1))//= must not have spaces on both sides when used as an assignment
When comparing: if [$a = $b]//= as a comparison, there must be spaces on both sides
1, Shell script variable name, equal sign, value cannot have spaces between
The naming must follow the following rules:
The first character must be a letter (a-z,a-z).
You can use an underscore (_) in the middle without spaces.
? punctuation cannot be used.
? You cannot use the keywords in bash (you can view the reserved keywords using the help command).
2. A variable is referenced by a $ symbol plus a variable name, for example:
Echo.. /${prov}/${datdir}
The curly braces outside the variable name are optional, plus the curly braces are used to help the interpreter identify the bounds of the variable, and it is a good habit to add curly braces to all the variables, which is easy to read and error-prone.
Shell script Hollow lattice attention problem: = Assignment can not have spaces on either side, and if comparison judgment = Both sides must be plus a space