Mail Archives: cygwin/1997/07/01/18:41:11
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".
- Raw text -