]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
test(GETARG): fix shellcheck SC2181
authorBenjamin Drung <benjamin.drung@canonical.com>
Wed, 12 Feb 2025 10:05:00 +0000 (11:05 +0100)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Wed, 12 Feb 2025 13:50:58 +0000 (14:50 +0100)
Fix shellcheck SC2181 in the getarg test case. This also makes the code
work with `set -e`.

test/TEST-80-GETARG/test.sh

index d1858bba9bd159498e21fb70647fdfa4d3690ad2..79804c89a69e19171d4770a008c6af3cf5c005a4 100755 (executable)
@@ -59,9 +59,7 @@ test_run() {
 
         INVALIDKEYS=("key" "4" "5" "6" "key8" "9" '"' "baz")
         for key in "${INVALIDKEYS[@]}"; do
-            val=$(./dracut-getarg "$key")
-            # shellcheck disable=SC2181
-            if (($? == 0)); then
+            if val=$(./dracut-getarg "$key"); then
                 echo "key '$key' should not be found"
                 ret=$((ret + 1))
             fi