title: Convert csh script to bash script
body: <p>I am currently converting a csh script on linux to a bash script on Mac OS X lion.</p>
  
  <p>The csh script looks like:</p>
  
  <pre><code>setenv CNS_SOLVE '/Users/ucbthsa/Documents/haddock2.1/software/bin/'
  setenv CNS_SOLVE $CNS_SOLVE
  if ( -d $CNS_SOLVE ) then
      if ( ! $?CNS_ARCH ) setenv CNS_ARCH `$CNS_SOLVE/bin/getarch`
  else
      setenv CNS_ARCH 'unknown'
  endif
  </code></pre>
  
  <p>My conversion to a Mac bash script looks as follows:</p>
  
  <pre><code>export CNS_SOLVE='/Users/ucbthsa/Documents/haddock2.1/software/bin/cns_solve_1.3'
  export CNS_SOLVE=$CNS_SOLVE
  
  if [ -d $CNS_SOLVE ]; then
    if [ ! $?CNS_ARCH ]; then
      export CNS_ARCH='$CNS_SOLVE/bin/getarch'
  else
    export CNS_ARCH='unknown'
  endif
  </code></pre>
  
  <p>When I try and source the Mac bash script I get the following error:</p>
  
  <blockquote>
    <p>-bash: cns_solve_env: line 10: syntax error: unexpected end of file</p>
  </blockquote>
  
  <p>I cannot understand why I am getting this error.</p>