#
# usage:	searchp.sh
#
# abstract:	This Bourne Shell script searches all the directories in your
#		PATH for a command and output the ones to the pathlist
#		variable.
#
# note(s):      1. This routine must be called using a . (period)
#		2. The global variable 'cmd' is the command.
#
# Copyright (c) 1992-94 by The MathWorks, Inc.
# $Revision: 1.6 $  $Date: 1994/03/23 22:00:42 $
#------------------------------------------------------------------------
#
	vpath=`echo $PATH | tr ":" " "`
#
	pathlist=""
	for dirname in $vpath
	do
	   if [ -d $dirname/$cmd ]; then
	      pathlist="$pathlist $dirname/$cmd"
	   else
	      lscmd=`ls -l $dirname/$cmd 2>/dev/null`
	      if [ "$lscmd" ]; then
	         pathlist="$pathlist $dirname/$cmd"
	      fi
	    fi
	done
