./chkf: line 30: syntax error near unexpected token `elif\'
\'/chkf: line 30: `elif [ -f \"$object\" ] ; then
if [ -d \"$object\" ] ; then
message=\"$message a
Now that you've added the additional error message, I have a thought: the ^M is \r, which is the Mac OS X line ending or part of the Windows line ending - Linux uses \n only as EOL. If you edit in vim, you should be able to see the ^M if it's not right through the file.