Make the type builtin not rely on the exit status of the which command

darcs-hash:20060314000641-ac50b-cc92a519b6c8981a50aea0f25f407dfe2b5f51dc.gz
This commit is contained in:
axel 2006-03-14 10:06:41 +10:00
parent 83d05f9170
commit 5f3ad87a98

View File

@ -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')