chiark
/
gitweb
/
~cjwatson
/
bin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
cb40d23
)
Cope with absolute file names (Debian bugs #162837 and #162967).
author
Colin Watson
<cjwatson@chiark.greenend.org.uk>
Tue, 1 Oct 2002 11:40:14 +0000
(11:40 +0000)
committer
Colin Watson
<cjwatson@chiark.greenend.org.uk>
Tue, 1 Oct 2002 11:40:14 +0000
(11:40 +0000)
pwhich
patch
|
blob
|
history
diff --git
a/pwhich
b/pwhich
index 807880c76989e550dbad70d91465b74931e34960..bf877c20768eae669dd968e53684157ff15f6c31 100755
(executable)
--- a/
pwhich
+++ b/
pwhich
@@
-5,13
+5,23
@@
RET=1
for PROGRAM in "$@"; do
IFS_SAVE="$IFS"
IFS=:
for PROGRAM in "$@"; do
IFS_SAVE="$IFS"
IFS=:
- for ELEMENT in $PATH; do
- if [ -f "$ELEMENT/$PROGRAM" ] && [ -x "$ELEMENT/$PROGRAM" ]; then
- echo "$ELEMENT/$PROGRAM"
- RET=0
- break
- fi
- done
+ case $PROGRAM in
+ */*)
+ if [ -x "$PROGRAM" ]; then
+ echo "$PROGRAM"
+ RET=0
+ fi
+ ;;
+ *)
+ for ELEMENT in $PATH; do
+ if [ -x "$ELEMENT/$PROGRAM" ]; then
+ echo "$ELEMENT/$PROGRAM"
+ RET=0
+ break
+ fi
+ done
+ ;;
+ esac
IFS="$IFS_SAVE"
done
IFS="$IFS_SAVE"
done