From 2608bea771190146ceabe79f785f1266a9f49cbc Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 30 Dec 2024 19:23:27 +0000 Subject: [PATCH] use command -v instead of which which is a non-standard command, whereas command is part of posix Signed-off-by: Leah Rowe --- build | 2 +- include/lib.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build b/build index af6c0d9..70baa4a 100755 --- a/build +++ b/build @@ -23,7 +23,7 @@ main() spath="script/$1"; shcmd="shift 1" [ "${1#-*}" != "$1" ] && spath="script/trees" && shcmd=":" - for g in "which git" "git config --global user.name" \ + for g in "command -v git" "git config --global user.name" \ "git config --global user.email" "git_init"; do eval "$g 1>/dev/null 2>/dev/null || $err \"Unconfigured: $g\"" done diff --git a/include/lib.sh b/include/lib.sh index f012645..ef54f14 100644 --- a/include/lib.sh +++ b/include/lib.sh @@ -16,8 +16,8 @@ err="err_" pyver="2" python="python3" -which python3 1>/dev/null || python="python" -which $python 1>/dev/null || pyver="" +command -v python3 1>/dev/null || python="python" +command -v $python 1>/dev/null || pyver="" [ -n "$pyver" ] && pyver="$($python --version | awk '{print $2}')" if [ "${pyver%%.*}" != "3" ]; then printf "Wrong python version, or python missing. Must be v 3.x.\n" 1>&2