]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
util/bash-completion: Fix SC2070 shellcheck error
authort.feng <fengtao40@huawei.com>
Tue, 6 Dec 2022 13:49:28 +0000 (21:49 +0800)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 7 Dec 2022 22:38:26 +0000 (23:38 +0100)
SC2070 (error): -n doesn't work with unquoted arguments.
Quote or use [[ ]].
In grub-completion.bash.in line 130:
             [ -n $tmp ] && {
                  ^--^ SC2070 (error)

More: https://github.com/koalaman/shellcheck/wiki/SC2070

Signed-off-by: t.feng <fengtao40@huawei.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
util/bash-completion.d/grub-completion.bash.in

index 44bf135b9f83e9201150fb36d96d8ce451e7c804..93d1434808e1b8630c85f13ea376c010f44f2db5 100644 (file)
@@ -127,7 +127,7 @@ __grub_list_modules () {
     local IFS=$'\n'
     COMPREPLY=( $( compgen -f -X '!*/*.mod' -- "${grub_dir}/$cur" | {
          while read -r tmp; do
-             [ -n $tmp ] && {
+             [ -n "$tmp" ] && {
                  tmp=${tmp##*/}
                  printf '%s\n' ${tmp%.mod}
              }