aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/type.fish
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2006-03-14 10:06:41 +1000
committerGravatar axel <axel@liljencrantz.se>2006-03-14 10:06:41 +1000
commit5f3ad87a981ba4d5a0cab0a7e2b934c9a8cf6f49 (patch)
treec92daa9752e60c16318e358c68cc0125b931988e /share/functions/type.fish
parent83d05f917052b81b943331d0bc03d5e0bae08cae (diff)
Make the type builtin not rely on the exit status of the which command
darcs-hash:20060314000641-ac50b-cc92a519b6c8981a50aea0f25f407dfe2b5f51dc.gz
Diffstat (limited to 'share/functions/type.fish')
-rw-r--r--share/functions/type.fish7
1 files changed, 5 insertions, 2 deletions
diff --git a/share/functions/type.fish b/share/functions/type.fish
index 6750e27a..4b48c122 100644
--- a/share/functions/type.fish
+++ b/share/functions/type.fish
@@ -105,12 +105,15 @@ function type -d (N_ "Print the type of a command")
end
- if which $i ^/dev/null >/dev/null
+ set -l path (which $i ^/dev/null)
+ set -l path_ok 0
+ count $path >/dev/null; and test -x $path; and set -l path_ok 1
+ if test $path_ok = 1
set status 0
set found 1
switch $mode
case normal
- printf (_ '%s is %s\n') $i (which $i)
+ printf (_ '%s is %s\n') $i $path
case type
printf (_ 'file\n')