./chkf: line 30: syntax error near unexpected token `elif\'
\'/chkf: line 30: `elif [ -f \"$object\" ] ; then
if [ -d \"$object\" ] ; then
message=\"$message a
It's your line endings. Transferring it from Windows has left the CR/LF
line endings on.
When I create a script then manually add the CR
characters, I get exactly the same error:
qq.sh: line 3: syntax error near unexpected token `elif'
'q.sh: line 3: `elif [ 1 == 1 ] ; then
You can fix it by removing the CR character from CR/LF line endings.
cat script.sh | sed '/\015/d' >newscript.sh
\015
octal representation as listed in ASCII