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 crontab and lrzip completions.
|
||||||
* Add gif to mplayer filename completions (Alioth: #312512).
|
* Add gif to mplayer filename completions (Alioth: #312512).
|
||||||
* Add "short" tarball extensions to unxz, unlzma etc completions.
|
* 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
|
-- David Paleino <d.paleino@gmail.com> Wed, 16 Jun 2010 17:53:22 +0200
|
||||||
|
|
||||||
|
@ -32,10 +32,11 @@ _service()
|
|||||||
return 0
|
return 0
|
||||||
} &&
|
} &&
|
||||||
complete -F _service service
|
complete -F _service service
|
||||||
[ -d /etc/init.d/ ] && (
|
for svc in /etc/init.d/*; do
|
||||||
services=$(for i in /etc/init.d/*; do
|
[ ! -x "$svc" ] || complete -p "${svc##*/}" &>/dev/null || \
|
||||||
complete -p ${i##*/} &>/dev/null || printf '%s\n' ${i##*/}; done)
|
complete -F _service -o default "${svc##*/}"
|
||||||
[ -n "$services" ] && complete -F _service -o default $services;)
|
done
|
||||||
|
unset svc
|
||||||
|
|
||||||
# Local variables:
|
# Local variables:
|
||||||
# mode: shell-script
|
# mode: shell-script
|
||||||
|
Loading…
x
Reference in New Issue
Block a user