[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 603c25903d68c5bb206412af0b43a588ec7c3e14
Ville Skyttä
ville.skytta at iki.fi
Mon Jun 28 17:00:55 UTC 2010
The following commit has been merged in the master branch:
commit 603c25903d68c5bb206412af0b43a588ec7c3e14
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon Jun 28 19:54:16 2010 +0300
Simplify/improve /etc/init.d/* completions.
Avoid subshell, do the right thing for filenames with spaces, do not
install completions for non-executable files.
diff --git a/CHANGES b/CHANGES
index 4e9595f..ab436c2 100644
--- a/CHANGES
+++ b/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 at gmail.com> Wed, 16 Jun 2010 17:53:22 +0200
diff --git a/contrib/service b/contrib/service
index f27222a..6efd7c1 100644
--- a/contrib/service
+++ b/contrib/service
@@ -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
--
bash-completion
More information about the Bash-completion-commits
mailing list