#
# 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.7 $  $Date: 1998/12/24 17:31:44 $
#------------------------------------------------------------------------
#
	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
