PageRenderTime 42ms CodeModel.GetById 39ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion_lib/complete/killall

http://github.com/brinkman83/bashrc
#! | 24 lines | 17 code | 7 blank | 0 comment | 0 complexity | 6095bc784b9ead33e5e3191a104d366f MD5 | raw file
 1# Linux and FreeBSD killall(1) completion.
 2
 3
 4comp_include _get_cword _signals
 5
 6
 7[ $UNAME = Linux -o $UNAME = FreeBSD ] &&
 8_killall()
 9{
10    local cur
11
12    COMPREPLY=()
13    cur=`_get_cword`
14
15    if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
16        _signals
17    else
18        COMPREPLY=( $( compgen -W '$( command ps axo command | \
19                  sed -ne "1d; s/^\[\?\([^-][^] ]*\).*$/\1/p" | \
20                  sed -e "s/.*\///" )' -- $cur ) )
21    fi
22
23    return 0
24} # _killall()