From 72ef383146995d4a65560263e84e356f9919de7f Mon Sep 17 00:00:00 2001 From: Lukas Macura Date: Mon, 21 Nov 2016 17:11:30 +0100 Subject: [PATCH] Internal which now search in more dirs --- install.sh | 5 +++-- lib/os.lib.sh | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 348dd84..2fd622e 100755 --- a/install.sh +++ b/install.sh @@ -21,8 +21,9 @@ zaf_which() { if which >/dev/null 2>/dev/null; then which "$1" else - [ -x /bin/$1 ] && { echo /bin/$1; return; } - [ -x /usr/bin/$1 ] && { echo /usr/bin/$1; return; } + for i in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin; do + [ -x $i/$1 ] && { echo $i/$1; return; } + done return 1 fi } diff --git a/lib/os.lib.sh b/lib/os.lib.sh index cd3c807..1948e14 100644 --- a/lib/os.lib.sh +++ b/lib/os.lib.sh @@ -24,8 +24,9 @@ zaf_which() { if which >/dev/null 2>/dev/null; then which "$1" else - [ -x /bin/$1 ] && { echo /bin/$1; return; } - [ -x /usr/bin/$1 ] && { echo /usr/bin/$1; return; } + for i in /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin; do + [ -x $i/$1 ] && { echo $i/$1; return; } + done return 1 fi }