aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_completion.d/kill.bash
blob: bdb42ec1b82a9c092fbbe2ba3c87120bdc039e95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# Complete kill builtin with jobspecs (prefixed with % so it will accept them)
# and this user's PIDs (requires pgrep(1))
_kill() {
    local pid
    while read -r pid ; do
        case $pid in
            "$2"*)
                COMPREPLY[${#COMPREPLY[@]}]=$pid
                ;;
        esac
    done < <( {
        compgen -A job -P%
        pgrep -u "$USER" .
    } 2>/dev/null )
}
complete -F _kill kill