[problem] the error content reported by the Linux server running the shell script is shown in the following figure.
[reason] incompatible carriage return and line feed characters under Linux and windows
[solution] change the windows newline character “CR lf” in the file to UNIX “LF”
Use Notepad + + to set the view first -> Display symbol -> When all symbols are displayed, you will see “CR lf”
Edit -> with Notepad + +; Document format conversion -> Convert to UNIX (LF)
Re-run to solve the problem.
Read More:
- Shell Script syntax error near unexpected token `done’
- Running shell script reports an error: “syntax error near unexpected token solution ‘”
- Ubuntu shell Script syntax error near unexpected token `$‘{\r‘‘
- [Solved] Shell error: syntax error: unexpected end of file
- Windows writes shell script and executes shell error [Solved]
- [Solved] shell Error: Syntax error: “(“ unexpected (expecting “}“)
- [Solved] bash: /etc/vimrc: line 15: syntax error near unexpected token `“autocmd“‘
- [Solved] Linux executes SQL script Error: Syntax error
- How to Solve Android Linux5.10 Kernel do_gettimeofday Function Error
- [Solved] Linux SSH Login Terminal Error: shell request failed on channel 0
- Linux changing password enter new UNIX password: passwd: authentication token manipulation error
- Prompt “entering emergency mode. Exit the shell to continue” if the Linux operating system does not start normally
- [Solved] Bash: Syntax error: redirection unexpected
- [Solved] Linux — 9 — txt files are copied from windows to Linux and read error
- [Solved] sbatch: error: Batch script contains DOS line breaks (\r\n)
- Shell: How to Get System Current Tme and Format it
- Centos7 Start Error: Entering emergency mode.Exit the shell to continue
- [Solved] yum command Error: “except keyboardinterrupt, e: syntax error: invalid syntax”“
- Error in Linux running file: bash: $’\r’: command not found
- [Solved] Linux Error: mipsel-linux-gcc: fatal error: no input files