aboutgitcode
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-04-06 15:22:02 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-04-06 15:35:55 +0200
commit4a4014391b6be9629046fbbd1968e175805ed9d4 (patch)
tree4f4ee5cf4028cd7a49b21ee74065ca8348ce9631
parentce1dd127fc892083318754f857dec6cf9579aae2 (diff)
downloadmbuto-4a4014391b6be9629046fbbd1968e175805ed9d4.tar
mbuto-4a4014391b6be9629046fbbd1968e175805ed9d4.tar.gz
mbuto-4a4014391b6be9629046fbbd1968e175805ed9d4.tar.bz2
mbuto-4a4014391b6be9629046fbbd1968e175805ed9d4.tar.lz
mbuto-4a4014391b6be9629046fbbd1968e175805ed9d4.tar.xz
mbuto-4a4014391b6be9629046fbbd1968e175805ed9d4.tar.zst
mbuto-4a4014391b6be9629046fbbd1968e175805ed9d4.zip
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 <sbrivio@redhat.com>
-rwxr-xr-xmbuto5
1 files 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