From 8ed0fad414daa81c7f7232139e3022b46106437f Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 4 Oct 2009 18:20:00 +0000 Subject: 27308, based on 27305 from Edgar Merino: search for init scripts in other locations --- Completion/Unix/Type/_services | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Type') diff --git a/Completion/Unix/Type/_services b/Completion/Unix/Type/_services index 2965e0f3e..40136e3c1 100644 --- a/Completion/Unix/Type/_services +++ b/Completion/Unix/Type/_services @@ -12,7 +12,19 @@ if chkconfig --list > /dev/null 2>&1; then 'init:init service:compadd -a inits' \ 'xinetd:xinetd service:compadd -a xinetds' && ret=0 else - _wanted services expl service compadd "$@" - /etc/init.d/*(-*:t) && ret=0 + local -a scriptpath + local dir + # Known locations of init scripts + # C.f. Unix/Commands/_init_d + scriptpath=(/etc/init.d /etc/rc.d /etc/rc.d/init.d) + + for dir in $scriptpath; do + if [[ -d $dir ]]; then + break + fi + done + _wanted services expl service compadd "$@" - $dir/*(-*:t) && + ret=0 fi return ret -- cgit 1.4.1