tools: tests: check exit code directly
authorKent Gibson <warthog618@gmail.com>
Mon, 3 Jun 2024 11:56:26 +0000 (19:56 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 3 Jun 2024 12:02:35 +0000 (14:02 +0200)
Fix shellcheck SC2181[1] - check exit code directly.

[1] https://www.shellcheck.net/wiki/SC2181

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20240603115628.102616-7-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
tools/gpio-tools-test.bash

index d9930f19a7409132b75bf845576b254c016a4ac6..83b05ecf252510475e93fee1fc3613840961a015 100755 (executable)
@@ -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