From 2a07329f7bb753cd31e2f01193eb1c46b4b582f0 Mon Sep 17 00:00:00 2001 From: Jacob Vallejo Date: Tue, 9 Nov 2021 15:10:55 -0800 Subject: fix: use POSIX standard builtin to search PATH Rather than iterating over paths to find a given executable, use the POSIX standard builtin `command` [1]. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html Signed-off-by: Jacob Vallejo --- server/autobuild | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/server/autobuild b/server/autobuild index 9af5990..7db0f0f 100755 --- a/server/autobuild +++ b/server/autobuild @@ -64,16 +64,7 @@ which() if [ -z "$1" ]; then return 1 fi - IFS=: - for dir in $PATH; do - if [ -x "$dir/$1" ]; then - printf "%s" "$dir/$1" - unset IFS - return 0 - fi - done - unset IFS - return 1 + command -v "$1" } # Quote $@ for the shell. -- cgit v1.0