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 <fengtao40@huawei.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
__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'
}
__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