_services: Avoid bogus completions when init or xinetd dirs exist but are empty.
This commit is contained in:
parent
38dc63d591
commit
50d44ca3a4
@ -1038,12 +1038,17 @@ _services()
|
||||
local sysvdir famdir
|
||||
[ -d /etc/rc.d/init.d ] && sysvdir=/etc/rc.d/init.d || sysvdir=/etc/init.d
|
||||
famdir=/etc/xinetd.d
|
||||
|
||||
local restore_nullglob=$(shopt -p nullglob); shopt -s nullglob
|
||||
|
||||
COMPREPLY=( $( printf '%s\n' $sysvdir/!($_backup_glob|functions) ) )
|
||||
|
||||
if [ -d $famdir ]; then
|
||||
COMPREPLY+=( $( printf '%s\n' $famdir/!($_backup_glob) ) )
|
||||
fi
|
||||
|
||||
$restore_nullglob
|
||||
|
||||
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#@($sysvdir|$famdir)/}' -- "$cur" ) )
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user