#
# 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-1998 The MathWorks, Inc. All Rights Reserved.
# $Revision: 1.8 $  $Date: 1999/01/11 19:24:51 $
#------------------------------------------------------------------------
#
	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
