From 4a4014391b6be9629046fbbd1968e175805ed9d4 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Wed, 6 Apr 2022 15:22:02 +0200 Subject: mbuto: Use which(1) instead of 'command -v' to look for program paths The output of 'command -v' varies widely across shells, which(1) output looks relatively consistent. Signed-off-by: Stefano Brivio --- mbuto | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mbuto b/mbuto index 70b2381..0003262 100755 --- a/mbuto +++ b/mbuto @@ -285,7 +285,7 @@ profile_kselftests() { # List of tools used here, assigned to uppercase variable names TOOLS="basename bc cat cd chmod cp cpio depmod diff dirname du file find grep gzip ldconfig ldd ln ls make mkdir mknod mktemp modprobe mv printf - readlink realpath rm rmdir seq sleep strip sync umount uname wget" + readlink realpath rm rmdir seq sleep strip sync umount uname wget which" # err() - Print error and exit # $@: Error message, optionally with printf format and arguments @@ -615,10 +615,9 @@ prog_add() { IFS=',' for __a in ${1}; do - __bin="$(command -v "${__a}")" && break + __bin="$(${WHICH} "${__a}")" && break done unset IFS - [ -z "${__bin}" ] && err "Can't source ${1}" # Binaries in /usr/libexec are meant to run on other hosts only, so they -- cgit v1.2.3