chiark
/
gitweb
/
~cjwatson
/
bin.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
pwhich: Portability fix, picked up by 'posh'.
[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" ] && [ -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"