[PATCH testsuite 1/2] check-syntax: use 'command -v' instead of 'which'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In minimal environments (e.g. Fedora container image) 'which' is not
installed by default. To avoid the need to install an additional
dependency, use 'command -v', which also does the trick and is a shell
builtin.

Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
---
 tools/check-syntax | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/check-syntax b/tools/check-syntax
index 0ca79e2..2115a79 100755
--- a/tools/check-syntax
+++ b/tools/check-syntax
@@ -27,7 +27,7 @@ CHK_PERL_EXCLUDE=""
 #
 function verify_deps() {
 	[[ -z "$1" ]] && return
-	if ! which "$1" >& /dev/null; then
+	if ! command -v "$1" >& /dev/null; then
 		echo "error: install \"$1\" and include it in your \$PATH"
 		exit 1
 	fi
-- 
2.29.2




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux