From 36a540f579ac80049dc07a8fe2ae1233180217c5 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Thu, 24 Feb 2022 13:53:29 +0900 Subject: [PATCH] fix(_included_ssh_config_files): fix for failglob --- bash_completion | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bash_completion b/bash_completion index 448479056f9..a317dba7af9 100644 --- a/bash_completion +++ b/bash_completion @@ -1766,7 +1766,7 @@ _included_ssh_config_files() { (($# < 1)) && echo "bash_completion: $FUNCNAME: missing mandatory argument CONFIG" >&2 - local configfile i f + local configfile i files f configfile=$1 local IFS=$' \t\n' reset=$(shopt -po noglob) @@ -1789,15 +1789,16 @@ _included_ssh_config_files() fi __expand_tilde_by_ref i # In case the expanded variable contains multiple paths - set +o noglob - for f in $i; do - if [[ -r $f ]]; then - config+=("$f") - # The Included file is processed to look for Included files in itself - _included_ssh_config_files $f - fi - done - $reset + _comp_expand_glob files '$i' + if ((${#files[@]})); then + for f in "${files[@]}"; do + if [[ -r $f ]]; then + config+=("$f") + # The Included file is processed to look for Included files in itself + _included_ssh_config_files $f + fi + done + fi done } # _included_ssh_config_files()