home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 April / PCO0499.ISO / filesbbs / os2 / apach134.arj / APACH134.ZIP / src / helpers / findprg.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1999-01-05  |  489 b   |  25 lines

  1. #!/bin/sh
  2. #
  3. # Usage: findprg.sh <program-name>
  4. # Return value is the absolute path of the program if it was found.
  5. # Initially written by Lars Eilebrecht <lars@apache.org>.
  6. #
  7. # This script falls under the Apache License.
  8. # See http://www.apache.org/docs/LICENSE
  9.  
  10.  
  11. if [ ".`which $1`" != . ]
  12. then
  13.   echo `which $1`
  14.   exit 0
  15. else
  16.   PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
  17.   if [ ".`which $1`" != . ]
  18.   then
  19.     echo `which $1`
  20.     exit 0
  21.   else
  22.     exit 1
  23.   fi
  24. fi
  25.