diff mbox series

[libgpiod,6/8] tools: tests: check exit code directly

Message ID 20240531134512.443850-7-warthog618@gmail.com
State Superseded
Headers show
Series tools: tests: fix shellcheck warnings | expand

Commit Message

Kent Gibson May 31, 2024, 1:45 p.m. UTC
Fix shellcheck SC2181[1] - check exit code directly.

Signed-off-by: Kent Gibson <warthog618@gmail.com>

[1] https://www.shellcheck.net/wiki/SC2181
---
 tools/gpio-tools-test.bash | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tools/gpio-tools-test.bash b/tools/gpio-tools-test.bash
index d9930f1..83b05ec 100755
--- a/tools/gpio-tools-test.bash
+++ b/tools/gpio-tools-test.bash
@@ -3069,8 +3069,7 @@  check_kernel() {
 check_prog() {
 	local PROG=$1
 
-	which "$PROG" > /dev/null
-	if [ "$?" -ne "0" ]
+	if ! which "$PROG" > /dev/null
 	then
 		die "$PROG not found - needed to run the tests"
 	fi