title: kill: not a pid or valid job spec
body: <p>I have created an application that is basically a deamon written in C.   It is stopped and started using a shell script.   Specifically, to stop it, kill is used to send a SIGTERM signal.   The PID of the daemon is stored in a file on the disc in the format:</p>
  
  <pre><code>1234\n
  </code></pre>
  
  <p>A user reports that they cannot stop the daemon, the shell script returns the error:</p>
  
  <pre><code>kill: `': not a pid or valid job spec
  </code></pre>
  
  <p>The PID is fetched and used in the shell script as follows:</p>
  
  <pre><code>if [ -f "${PID_FILE}" ]
  then
      FCPID=`head -n 1 $PID_FILE`
      kill -n SIGTERM "${FCPID}"
      RETVAL=$?
      if [ $RETVAL -eq 0 ]
      then
          rm -f ${PID_FILE}
          echo "OK"
      else
          echo "FAIL"
          exit 1
      fi
  else
      echo "Wasn't running"
      exit 1
  fi
  </code></pre>
  
  <p>It works fine on my machine (Ubuntu 10.04) and so far no one else has reported this problem.   Does anyone recognise the error or is there a mistake in the shell script that could cause problems on some platforms?</p>