From: mchase AT ix DOT netcom DOT com ("Michael A. Chase") Subject: My own which/whence 1 Jul 1997 18:41:11 -0700 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <199707012227.RAA24358.cygnus.gnu-win32@dfw-ix8.ix.netcom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Original-To: Original-Cc: "Kang Su Gatlin" X-MSMail-Priority: Normal X-Priority: 3 X-Mailer: Microsoft Internet Mail 4.70.1161 Original-Sender: owner-gnu-win32 AT cygnus DOT com I found myself without which a while back and rolled my own. It also will search for non-executable files and on other 'path' variables. ================== : # onn_path.sh: Echo full specification of a file found in a search list # Normally called in back-quotes # _Don't_ execute with . !!! # -q = Quiet, don't complain if not found # -m = Multiple, report all files found on path # '$1' = File name # '$2'... = Search list and additional directories to search Once=true Noisy=true while [ $# -gt 0 ]; do case X$1 in X-m) Once=false; shift ;; X-q) Noisy=false; shift ;; *) break ;; esac done if [ $# -lt 2 ]; then exit 1; fi # Get the file name and parse search list file=$1; shift list=`echo $* | \ sed -e 's/^:/\.:/g' -e 's/::/:\.:/g' -e 's/:$/:\./g' -e 's/:/ /g'` # Seek out the file None=true if [ `basename $file` != "$file" ]; then if [ -r $file ]; then echo $file; None=false; $Once && exit 0; fi else for dir in $list; do if [ -r $dir/$file ]; then echo $dir/$file; None=false; $Once && exit 0 fi done fi if $Noisy && $None; then echo no $file in $list >&2 fi - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".