in C, you can occasionally see variable assignments as follows:
x1 = x2 = 1;
this means that the variable x1 is equal to the variable x2 is equal to 2, and the execution is the same thing as
x1 = 1;
x2 = 1;
but in shell script assignment, meaning is different, if the command line x1 = x2 = 1, then the expression means the variable x1 is equal to x2 = 1, where x2 = 1 this is a string as a whole, there is no x2 variable, the test is as follows:
xxxxxx@STB-240:~$ Test1=Test2=1
xxxxxx@STB-240:~$
xxxxxx@STB-240:~$ echo $Test1
Test2=1
xxxxxx@STB-240:~$ echo $Test2
xxxxxx@STB-240:~$
xxxxxx@STB-240:~$
note: under the shell, only the value before the first equals sign is a variable, followed by the value of the variable.
Read More:
- Global variable error: unboundlocalerror: local variable ‘l’ referenced before assignment
- Python UnboundLocalError: local variable ‘num’ referenced before assignment
- Python error: local variable ‘XXXX’ referenced before assignment
- Solving Python error: local variable ‘a’ referenced before assignment
- Shell script: syntax error: bad for loop variable error resolution
- Error: global variable is ambiguous (conflict between using namespace STD and global variable)
- C + + programming fault handling — error: assignment of read only data member ‘STD:: pair
- Using the decorator may prompt property assignment expected. Vetur (1136)
- Unity “Feature `out variable declaration’ cannot be used because it is not part of the C# 4.0” error
- Python Numpy.ndarray ValueError:assignment destination is read-only
- Assignment under multiple single edges is not supported for synthesis
- Python error type error: ‘range’ object does not support item assignment, solution
- error Expected an assignment or function call and instead saw an expression
- error C4996: ‘scanf’: This function or variable may be unsafe. Consider using scanf_s instead.
- Arrow function should not return assignment no-return-assign
- Differences between length() size() and C strlen() of C + + string member functions
- error C4996: ‘scanf‘: This function or variable may be unsafe.Visual Studio Series compilers report errors using scanf function
- Solve the problem of shell script “syntax error near unexpected token `fi’”.
- The shell script exits after an error is reported
- The difference between single equal sign and double equal sign EQ in shell script