Simplify/improve /etc/init.d/* completions.
Avoid subshell, do the right thing for filenames with spaces, do not install completions for non-executable files.
This commit is contained in:
parent
2e95443e14
commit
603c25903d
1
CHANGES
1
CHANGES
@ -8,6 +8,7 @@ bash-completion (2.x)
|
||||
* Add crontab and lrzip completions.
|
||||
* Add gif to mplayer filename completions (Alioth: #312512).
|
||||
* Add "short" tarball extensions to unxz, unlzma etc completions.
|
||||
* Improve /etc/init.d/* completions.
|
||||
|
||||
-- David Paleino <d.paleino@gmail.com> Wed, 16 Jun 2010 17:53:22 +0200
|
||||
|
||||
|
@ -32,10 +32,11 @@ _service()
|
||||
return 0
|
||||
} &&
|
||||
complete -F _service service
|
||||
[ -d /etc/init.d/ ] && (
|
||||
services=$(for i in /etc/init.d/*; do
|
||||
complete -p ${i##*/} &>/dev/null || printf '%s\n' ${i##*/}; done)
|
||||
[ -n "$services" ] && complete -F _service -o default $services;)
|
||||
for svc in /etc/init.d/*; do
|
||||
[ ! -x "$svc" ] || complete -p "${svc##*/}" &>/dev/null || \
|
||||
complete -F _service -o default "${svc##*/}"
|
||||
done
|
||||
unset svc
|
||||
|
||||
# Local variables:
|
||||
# mode: shell-script
|
||||
|
Loading…
x
Reference in New Issue
Block a user