Problem description
The run.sh script is executed to report an error with the following message:
/data/app/information-provider
: No such file or directory
: command not found
./run.sh: line 4: syntax error near unexpected token `newline'
'/run.sh: line 4: `case "$1" in
Problem analysis
Look for the script. The script is fine, so I wonder if the file format is incorrect.
view the file with the following command,
cat -A run.sh
Find that in run.sh, the newline ends with ^M$
server="$( dirname "${BASH_SOURCE[0]}" )" && pwd ^M$
cd $server^M$
^M$
case "$1" in ^M$
^M$
...
The solution
Execute the following statement to convert run.sh to a line break of $in the Linux environment
dos2unix run.sh
View the conversion file through Cat-a run.sh as:
server="$( dirname "${BASH_SOURCE[0]}" )" && pwd $
cd $server$
$
case "$1" in $
$
Read More:
- Shell script syntax error near unexpected token ‘$’Do
- Solve the problem of shell script “syntax error near unexpected token `fi’”.
- Docker machine install syntax error near unexpected token ‘newline’! DOCTYPE HTML problem resolution
- Shell script execution error: “syntax error near unexpected token”
- 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
- When sh. / xxx.sh is executed, syntax error: “unexpected” appears
- syntax error near unexpected token `then’ problem solution
- Unexpected syntax error: unexpected token<
- syntax error near unexpected token `else’
- Syntax error: unexpected token in uni app project compilation
- Uncaught syntax error: unexpected token ‘< 0‘
- [shell] sh executes the script and reports an error syntax error: “(” unexpected “)
- Error: unexpected syntax error: unexpected token<
- Error: syntax error – unexpected token P in JSON at position 0
- About writing [if] and [else] statements in JSP, Syntax error on token “else”, delete this token
- Baidu editor echo JS error uncaught syntax error: invalid or unexpected token
- Syntax error on token “}“, delete this token
- Syntax error: unexpected end of file problem [two solutions]