title: Why lsof command not found in shell script, but it works well in Terminal
body: <p>The lsof command in my shell script is not working, but it works well in Terminal. I have set the full path of the lsof command, but always throwout a error about this:</p>
  
  <pre><code>lsof: unacceptable port specification in: -i :
  lsof 4.89
   latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
   latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
   latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
   usage: [-?abhlnNoOPRtUvV] [+|-c c] [+|-d s] [+D D] [+|-f[cgG]]
   [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+|-M] [-o [o]] [-p s]
   [+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
  Use the ``-h'' option to get more help information.
  
  
  function launchAnyproxy()
  {
      cd ../..
      port=`/usr/sbin/lsof -t -i :8888`
      echo $port
      #port=`netstat -ln |grep '8888'`
      if [ ! -n "$port" ]; then
          anyproxy --intercept
      else
          echo "8888 is listening by other process"
      fi
  }
  
  launchAnyproxy
  </code></pre>