#!/bin/sh # ApplicationExists # 2008-02-26 # Chieh Cheng # GNU General Public License (GPL), Version 2, June 1991 scriptname=`echo $0 | sed s/\\\\/.*\\\\///g` if [ $# -eq 1 ] then application="$1" location=`which "${application}" 2>&1` if [ "${location}" = "" ] then result=1; else result=`echo "${location}" | egrep -c "Command not found|no ${application} in"` fi if [ $result -eq 1 ] then echo 0 else echo 1 fi else echo " Usage: $scriptname \"app\"" fi