Solved the problem of "[: XXXX: unexpected operator" when compiling the. sh file in linux,
I often compile a. sh file in linux to generate a project. It has never been a problem before, and the code has never changed. However, when compiling today, an error is prompted:
Then I thought it was hard to understand. I checked my. sh file, and many [] of them reported these errors, but it never went wrong.
Later, we found that the default sh in ubuntu is connected to dash, and an error occurred because dash is incompatible with bash. during execution, you can replace sh with the bash file name. sh to execute. successful. dash is something. After checking it, it should also be a shell, which seems to be a lot of criticism from users.
Modify sh to connect to bash by default:
Sudo dpkg-reconfigure dash
Select no!
Compile again! Pass! Done!