summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vallejo <jake@jahkeup.com>2021-11-09 15:10:55 -0800
committerVedang Manerikar <ved.manerikar@gmail.com>2021-11-10 10:21:26 +0530
commit2a07329f7bb753cd31e2f01193eb1c46b4b582f0 (patch)
tree81ba57df3e6c8998d0dda6d454256c1c135bbb70
parent8a7804acb66e3ec462cbea542958f8db9bbcbee3 (diff)
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 <jake@jahkeup.com>
-rwxr-xr-xserver/autobuild11
1 files changed, 1 insertions, 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.