It is correct for standard bash, but in order to speed up the boot up, Ubuntu uses dash instead of traditional bash
solution: cancel dash
1. Execution: sudo dpkg reconfigure dash
2. Option: select No
Read More:
- [shell] sh executes the script and reports an error syntax error: “(” unexpected “)
- Prompt when executing sh file in Linux: nohup: unable to run command “. / startup. Sh”: insufficient permissions
- Error when Linux executes sh script: syntax error: bad FD number
- Syntax error near unexpected token `newline’script cannot be executed
- The solution of push D command execution error (/ bin / sh: 1: push D: not found) on Ubuntu
- SH script reports error “Eval: Line 1: syntax error: terminated quoted string”
- “Sh: dot: not found” when Doxygen generates documents
- Flutter – iOS: Command /bin/sh failed with exit code 255
- Find files with suffix. Sh under Linux
- sh: 0: getcwd() failed: No such file or directory
- Solve the problem of syntax error: unexpected end of file or syntax error near unexpected token ` fi ‘error
- Syntax error near unexpected token ‘$’Do is reported when running bash file
- [development experience] solution to unexpected syntax error: unexpected identifier in JSON parsing
- Solve the problem of syntax error: invalid syntax in PIP install XXX
- Unexpected syntax error: unexpected token<
- “Unexpected syntax error: unexpected identifier”.
- Uncaught syntax error: unexpected token ‘< 0‘
- [Fixed] Syntax error: word unexpected (expecting “)”)
- syntax error near unexpected token `else’
- Shell script: syntax error: bad for loop variable error resolution