mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
s390-tools: Replace 'which' with built-in 'command -v'
There are still a few scripts using the 'which' command to determine either the full path or the mere existence of an executable. Some of these scripts might run in minimal environments where 'which' is not available due to dependency restriction. 'which' is also considered unreliable for historical implementation details. Use the POSIX defined [1] built-in 'command -v' instead to reduce package dependencies and improve reliability. [1] https://pubs.opengroup.org/onlinepubs/9699919799/ Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
This commit is contained in:
committed by
Steffen Eiden
parent
4d2c9267c2
commit
0b0960254e
@@ -15,7 +15,7 @@
|
||||
prog_name=`basename $0`
|
||||
guest_name=${USER:-`whoami 2>/dev/null`}
|
||||
terminal=lnxhvc0
|
||||
iucvconn=`which iucvconn 2>/dev/null`
|
||||
iucvconn=`command -v iucvconn 2>/dev/null`
|
||||
|
||||
__error() {
|
||||
printf "$prog_name: $@\n" >&2
|
||||
|
||||
@@ -127,7 +127,7 @@ echo "$cmd: Copying kexec"
|
||||
# Install both binary and required shared libraries
|
||||
OLDPATH=$PATH
|
||||
PATH=$OLDPATH:/sbin:/usr/sbin
|
||||
kexec_bin=$(which kexec)
|
||||
kexec_bin=$(command -v kexec)
|
||||
kexec_sos=$(sharedobjs $kexec_bin)
|
||||
PATH=$OLDPATH
|
||||
|
||||
|
||||
+1
-2
@@ -667,8 +667,7 @@ function check_free_space_mileage() {
|
||||
|
||||
|
||||
function check_blktrace() {
|
||||
which blktrace >/dev/null 2>&1;
|
||||
if [ $? -ne 0 ]; then
|
||||
if ! command -v blktrace >/dev/null 2>&1; then
|
||||
echo "$WRP_TOOLNAME: Could not find blktrace. Please make sure that the blktrace package is installed and matches the level in the documentation.";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user