I wrote it this way at first, but I got an error
#!/bin/bash
filename=$1
if [ -e /home/xx/$filename ]
echo "exist"
else
echo "inexistence"
fi
It turned out there was a then missing
#!/bin/bash
filename=$1
if [ -e /home/xx/$filename ]
then
echo "exist"
else
echo "inexistence"
fi
It’s ok after modification!
Read More:
- syntax error near unexpected token `then’ problem solution
- Solve the problem of syntax error: unexpected end of file or syntax error near unexpected token ` fi ‘error
- Solve the problem of shell script “syntax error near unexpected token `fi’”.
- Unexpected syntax error: unexpected token<
- Syntax error near unexpected token `newline’script cannot be executed
- Syntax error near unexpected token ‘$’Do is reported when running bash file
- Uncaught syntax error: unexpected token ‘< 0‘
- Shell script syntax error near unexpected token ‘$’Do
- Docker machine install syntax error near unexpected token ‘newline’! DOCTYPE HTML problem resolution
- Syntax error: unexpected token in uni app project compilation
- Shell script execution error: “syntax error near unexpected token”
- Error: unexpected syntax error: unexpected token<
- Error: syntax error – unexpected token P in JSON at position 0
- Baidu editor echo JS error uncaught syntax error: invalid or unexpected token
- About writing [if] and [else] statements in JSP, Syntax error on token “else”, delete this token
- Syntax error on token “eat”, identifier expected after this token
- Syntax error on token “}“, delete this token
- “Unexpected syntax error: unexpected identifier”.
- [development experience] solution to unexpected syntax error: unexpected identifier in JSON parsing
- Unexpected token appears in JS