[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 1f8b55a92aba6d03bb4c43dade1f8b2e2b847b61

David Paleino dapal at debian.org
Thu Jun 17 15:45:54 UTC 2010


The following commit has been merged in the master branch:
commit 1f8b55a92aba6d03bb4c43dade1f8b2e2b847b61
Author: David Paleino <dapal at debian.org>
Date:   Thu Jun 17 17:43:18 2010 +0200

    Fixed "service" completion, thanks to John Hedges (Debian: #586210)
    
      The patch makes it safe even when every file in /etc/init.d/*
      has a proper completion (unlikely, but seems like it happened).
    
      Thanks to John Hedges <john at drystone.co.uk> for the patch, slightly
      modified to make it more compact.

diff --git a/CHANGES b/CHANGES
index 46885ea..bb09a83 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,7 @@
 bash-completion (2.x)
 
   [ David Paleino ]
-  * Start work on 2.0
+  * Fixed "service" completion, thanks to John Hedges (Debian: #586210)
 
   [ Ville Skyttä ]
   * Activate hping2 completion also for hping and hping3.
diff --git a/contrib/service b/contrib/service
index 9ebd117..f27222a 100644
--- a/contrib/service
+++ b/contrib/service
@@ -32,9 +32,10 @@ _service()
     return 0
 } &&
 complete -F _service service
-[ -d /etc/init.d/ ] && complete -F _service -o default \
-    $(for i in /etc/init.d/*; do
-    complete -p ${i##*/} &>/dev/null || printf '%s\n' ${i##*/}; done)
+[ -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;)
 
 # Local variables:
 # mode: shell-script

-- 
bash-completion



More information about the Bash-completion-commits mailing list