title: Syntax error near unexpected token `elif'
body: <pre><code>./chkf: line 30: syntax error near unexpected token `elif'
  '/chkf: line 30: `elif [ -f "$object" ] ; then
  
  
  if [ -d "$object" ] ; then
      message="$message a directory"
  elif [ -f "$object" ] ; then
      message="$message a regular file."
  else
      message="$message not a known file type"
  fi
  </code></pre>
  
  <p>Also this,</p>
  
  <pre><code>./chkf: line 38: syntax error near unexpected token `else'
  '/chkf: line 38: `else 
  
  if [ -w "$object" ] ; then
      write="writeable"
  else 
      write="not writeable"
  fi
  </code></pre>
  
  <p>What is wrong with this? It seems to be correct. I tried so many variations and cannot figure out what is wrong. Is there some kind of invisible character? If so, is there a command to strip it?</p>
  
  <p><strong>Edit:</strong> When I add <code>#!/bin/bash</code> at the top, I get the following error:</p>
  
  <pre><code>interpreter "/bin/bash" not found
  file link resolves to "/usr/bin/bash"
  -bash: ./chkf: /bin/bash^M: bad interpreter: No such file or directory
  </code></pre>