]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(dracut-lib): quote _b variable
authorBenjamin Drung <benjamin.drung@canonical.com>
Thu, 13 Jun 2024 23:25:09 +0000 (01:25 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Sat, 15 Jun 2024 02:01:57 +0000 (22:01 -0400)
shellcheck complains about SC2086 (info): Double quote to prevent
globbing and word splitting.

The variable `_b` contains a digit without spaces (as validated by
`isdigit`) and therefore is safe to quote.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
modules.d/99base/dracut-lib.sh

index efd079cda82bcf4eb08e67b2846bccb5c0d191fc..1aca01f60ff2f6deabd0e7cb15a846e0a5d9175d 100755 (executable)
@@ -266,7 +266,7 @@ getargnum() {
     _b=$(getarg "$1") || _b=${_b:-"$_default"}
     if [ -n "$_b" ]; then
         isdigit "$_b" && _b=$((_b)) \
-            && [ $_b -ge "$_min" ] && [ $_b -le "$_max" ] && echo $_b && return
+            && [ "$_b" -ge "$_min" ] && [ "$_b" -le "$_max" ] && echo "$_b" && return
     fi
     echo "$_default"
 }