util/bash-completion: Fix SC2070 shellcheck error

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>
This commit is contained in:
t.feng 2022-12-06 21:49:28 +08:00 committed by Daniel Kiper
parent e375394fb9
commit 2029c4822b

View 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}
}