chiark / gitweb /
47aa80cbad326c2c5d404769188de1d5c873aded
[bin.git] / pwhich
1 #! /bin/sh -e
2
3 RET=1
4 for PROGRAM in "$@"; do
5  IFS_SAVE="$IFS"
6  IFS=:
7  for ELEMENT in $PATH; do
8   if [ -f "$ELEMENT/$PROGRAM" -a -x "$ELEMENT/$PROGRAM" ]; then
9    echo "$ELEMENT/$PROGRAM"
10    RET=0
11    break
12   fi
13  done
14  IFS="$IFS_SAVE"
15 done
16
17 exit "$RET"