diff options
author | Tom Gundersen <teg@jklm.no> | 2011-06-18 22:30:22 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2011-06-18 22:30:22 +0200 |
commit | f5d571110b9cfe45ecb32602510c924409e52d63 (patch) | |
tree | f7738f1b652c909eb6b27103b6b9393e5af563a6 /bash-completion | |
parent | 4cad51425325abf13b7a8772ff09f852238423c2 (diff) | |
parent | 042d197b4d989ec6461204b9d897054e5f5dd492 (diff) | |
download | initscripts-f5d571110b9cfe45ecb32602510c924409e52d63.tar.xz |
Merge remote-tracking branch 'seblu/master'
Diffstat (limited to 'bash-completion')
-rw-r--r-- | bash-completion | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bash-completion b/bash-completion index 5151972..489b5dc 100644 --- a/bash-completion +++ b/bash-completion @@ -5,15 +5,17 @@ _rc.d () local action="help list start stop reload restart" local cur="${COMP_WORDS[COMP_CWORD]}" local caction="${COMP_WORDS[1]}" - if ((${COMP_CWORD} == 1)); then + if ((COMP_CWORD == 1)); then COMPREPLY=($(compgen -W "${action}" -- "$cur")) - elif [[ "$caction" =~ help|list ]]; then + elif [[ "$caction" == help ]]; then COMPREPLY=() + elif [[ "$caction" == list ]]; then + ((COMP_CWORD == 2)) && COMPREPLY=($(compgen -W "started stopped" -- "$cur")) || COMPREPLY=() elif [[ "$caction" == start ]]; then COMPREPLY=($(comm -23 <(cd /etc/rc.d && compgen -f -X 'functions*' "$cur"|sort) <(cd /run/daemons/ && compgen -f "$cur"|sort))) elif [[ "$caction" =~ stop|restart|reload ]]; then COMPREPLY=($(cd /run/daemons/ && compgen -f "$cur"|sort)) - elif ((${COMP_CWORD} > 1)); then + elif ((COMP_CWORD > 1)); then COMPREPLY=($(cd /etc/rc.d && compgen -f -X 'functions*' "$cur"|sort)) fi } |