According to the shell programming of laruence's private dish, there is an inexplicable problem.
For example:
# Test if else
Read-P "input y/n? : "YN
If [$ YN = "Y"]; then
Echo "continue ;"
Elif [$ YN = "N"]; then
Echo "break ;"
Else
Echo "PLS input something ."
Fi
During execution, the [: 12: Y: Unexpected Operator
Instead, I ran to the terminal and entered it according to the shell command. It was a success and I couldn't help but sigh again about the strange problem.
Finally, I found the answer on the Internet:
First:
Original address: http://www.ylmf.net/read.php? Tid = 1377788 & page = E & fpage = 5
Because the default SH of Ubuntu is connected to dash, and the dash and bash are incompatible, an error occurs. 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.
By the way, modify sh to connect to bash by default:
Sudo dpkg-reconfigure dash
Select No.
Second:
See the results of others' discussions in a forum.
Change = To =. Dash uses = to judge that the string is equal.