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/Command/_init_d | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_init_d') diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d index 9a5ed9ae7..72d11023f 100644 --- a/Completion/Unix/Command/_init_d +++ b/Completion/Unix/Command/_init_d @@ -7,7 +7,20 @@ _compskip=all # This should probably be system specific... script=$words[1] -[[ $script = */* ]] || script=/etc/init.d/$script +if [[ $script != */* ]]; then + local -a scriptpath + local dir + # Known locations of init scripts + # C.f. Unix/Type/_services + scriptpath=(/etc/init.d /etc/rc.d /etc/rc.d/init.d) + + for dir in $scriptpath; do + if [[ -f $dir/$script ]]; then + script=$dir/$script + break + fi + done +fi # If the file starts with `#!' we hope that this is a shell script # and get lines looking like foo|bar) with the words in $what. -- cgit 1.4.1