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()
2542
2542
[[ $realcmd ]] && paths=(" ${realcmd%/* } " ) || paths=()
2543
2543
_comp_split -aF : paths " $PATH "
2544
2544
for dir in " ${paths[@]%/ } " ; do
2545
- if [[ -d $dir && $dir == ?*/@(bin|sbin) ]]; then
2545
+ [[ $dir == ?*/@(bin|sbin) ]] &&
2546
2546
dirs+=(" ${dir%/* } /share/bash-completion/completions" )
2547
- fi
2548
2547
done
2549
2548
2550
2549
# 4) From XDG_DATA_DIRS or system dirs (e.g. /usr/share, /usr/local/share):
@@ -2557,10 +2556,14 @@ __load_completion()
2557
2556
2558
2557
# Look up and source
2559
2558
shift
2560
- local prefix
2559
+ local i prefix compspec
2561
2560
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
2564
2567
for compfile in " $prefix$cmdname " " $prefix$cmdname .bash" ; do
2565
2568
compfile=" $dir /$compfile "
2566
2569
# 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