From 425b1199b0cb2116ac84cd286d29569e62d86774 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sat, 26 Apr 2008 00:50:21 +0000 Subject: [PATCH] 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 --- data/etc/profile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/data/etc/profile b/data/etc/profile index 4ea4aa8385..2452a1f0bf 100644 --- a/data/etc/profile +++ b/data/etc/profile @@ -60,6 +60,8 @@ whence() return 1 fi + returnValue=0 + for cmd do if [ "$vflag" ] ; then @@ -70,12 +72,15 @@ whence() echo $path else case "$cmd" in - /*) if [ -x "$cmd" ]; then - echo "$cmd" + */*) if [ -x "$cmd" ]; then + echo "$cmd" + else + returnValue=1 fi ;; *) case "$(builtin type -type $cmd)" in - "") ;; + "") returnValue=1 + ;; *) echo "$cmd" ;; esac @@ -84,7 +89,7 @@ whence() fi fi done - return 0 + return $returnValue } alias which='whence'