1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
commit 1f8b55a92aba6d03bb4c43dade1f8b2e2b847b61
Author: David Paleino <dapal@debian.org>
Date: Thu Jun 17 17:43:18 2010 +0200
Subject: 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@drystone.co.uk> for the patch, slightly
modified to make it more compact.
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=586210
---
contrib/service | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- bash-completion.orig/contrib/service
+++ bash-completion/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
|