I don't know, if that makes is less almost-ksh compatible, but whence
(aka which) now returns 1 when it cannot find a specified command. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25169 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+9
-4
@@ -60,6 +60,8 @@ whence()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
returnValue=0
|
||||||
|
|
||||||
for cmd
|
for cmd
|
||||||
do
|
do
|
||||||
if [ "$vflag" ] ; then
|
if [ "$vflag" ] ; then
|
||||||
@@ -70,12 +72,15 @@ whence()
|
|||||||
echo $path
|
echo $path
|
||||||
else
|
else
|
||||||
case "$cmd" in
|
case "$cmd" in
|
||||||
/*) if [ -x "$cmd" ]; then
|
*/*) if [ -x "$cmd" ]; then
|
||||||
echo "$cmd"
|
echo "$cmd"
|
||||||
|
else
|
||||||
|
returnValue=1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*) case "$(builtin type -type $cmd)" in
|
*) case "$(builtin type -type $cmd)" in
|
||||||
"") ;;
|
"") returnValue=1
|
||||||
|
;;
|
||||||
*) echo "$cmd"
|
*) echo "$cmd"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -84,7 +89,7 @@ whence()
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
return 0
|
return $returnValue
|
||||||
}
|
}
|
||||||
|
|
||||||
alias which='whence'
|
alias which='whence'
|
||||||
|
|||||||
Reference in New Issue
Block a user