File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -2542,9 +2542,8 @@ __load_completion()
25422542 [[ $realcmd ]] && paths=(" ${realcmd%/* } " ) || paths=()
25432543 _comp_split -aF : paths " $PATH "
25442544 for dir in " ${paths[@]%/ } " ; do
2545- if [[ -d $dir && $dir == ?*/@(bin|sbin) ]]; then
2545+ [[ $dir == ?*/@(bin|sbin) ]] &&
25462546 dirs+=(" ${dir%/* } /share/bash-completion/completions" )
2547- fi
25482547 done
25492548
25502549 # 4) From XDG_DATA_DIRS or system dirs (e.g. /usr/share, /usr/local/share):
@@ -2557,10 +2556,14 @@ __load_completion()
25572556
25582557 # Look up and source
25592558 shift
2560- local prefix
2559+ local i prefix compspec
25612560 for prefix in " " _; do # Regular from all dirs first, then fallbacks
2562- for dir in " ${dirs[@]} " ; do
2563- [[ -d $dir ]] || continue
2561+ for i in ${! dirs[*]} ; do
2562+ dir=${dirs[i]}
2563+ if [[ ! -d $dir ]]; then
2564+ unset -v 'dirs[i]'
2565+ continue
2566+ fi
25642567 for compfile in " $prefix$cmdname " " $prefix$cmdname .bash" ; do
25652568 compfile=" $dir /$compfile "
25662569 # Avoid trying to source dirs as long as we support bash < 4.3
You can’t perform that action at this time.
0 commit comments