From: t.feng Date: Tue, 6 Dec 2022 13:49:30 +0000 (+0800) Subject: util/bash-completion: Fix SC2155 shellcheck warning X-Git-Tag: grub-2.12-rc1~190 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9802fbdeb5ce94aaa8f0acf955778b9167c3158;p=thirdparty%2Fgrub.git util/bash-completion: Fix SC2155 shellcheck warning SC2155 (warning): Declare and assign separately to avoid masking return values. The exit status of the command is overridden by the exit status of the creation of the local variable. In grub-completion.bash.in line 115: local config_file=$(__grub_dir)/grub.cfg ^---------^ SC2155 (warning) In grub-completion.bash.in line 126: local grub_dir=$(__grub_dir) ^------^ SC2155 (warning) More: https://github.com/koalaman/shellcheck/wiki/SC2155 Signed-off-by: t.feng Reviewed-by: Daniel Kiper --- diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in index d3399f0e1..a85f18f05 100644 --- a/util/bash-completion.d/grub-completion.bash.in +++ b/util/bash-completion.d/grub-completion.bash.in @@ -115,7 +115,8 @@ __grub_get_last_option () { __grub_list_menuentries () { local cur="${COMP_WORDS[COMP_CWORD]}" - local config_file=$(__grub_dir)/grub.cfg + local config_file + config_file=$(__grub_dir)/grub.cfg if [ -f "$config_file" ];then local line IFS=$'\n' @@ -129,7 +130,8 @@ __grub_list_menuentries () { } __grub_list_modules () { - local grub_dir=$(__grub_dir) + local grub_dir + grub_dir=$(__grub_dir) local line tmp IFS=$'\n' COMPREPLY=() while read -r line; do