#!/bin/sh
checkForCmdInPath()
{
var=$1
OldIFS=$IFS
IFS=":"
for directory in $PATH
do
if [ -x $directory/${var##/*/} ]
then
echo "${var##/*/} found in $directory"
return
fi
done
echo "${var##/*/} not found"
IFS=oldIFS
}
if [ $# -ne 1 ]
then
echo "Usage: $0 command" >&2
exit 1
fi
checkForCmdInPath "$1"
exit 0
|