diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-05 12:56:25 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-05 12:56:25 +1200 |
commit | 015aae34735751e74d5143a3f91d88f44b19ab6e (patch) | |
tree | e97cba5cf681bd369ff5b3e44a83a8512cb02172 /bash/bash_completion.d/kill.bash | |
parent | Flesh out builtin completions a little (diff) | |
download | dotfiles-015aae34735751e74d5143a3f91d88f44b19ab6e.tar.gz dotfiles-015aae34735751e74d5143a3f91d88f44b19ab6e.zip |
Complete kill builtin with jobspecs and user PIDs
Diffstat (limited to 'bash/bash_completion.d/kill.bash')
-rw-r--r-- | bash/bash_completion.d/kill.bash | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bash/bash_completion.d/kill.bash b/bash/bash_completion.d/kill.bash new file mode 100644 index 00000000..0aca041f --- /dev/null +++ b/bash/bash_completion.d/kill.bash @@ -0,0 +1,15 @@ +# Complete kill builtin with jobspecs (prefixed with % so it will accept them) +# and this user's PIDs (requires pgrep(1)) +_kill() { + while read -r pid ; do + case $pid in + "${COMP_WORDS[COMP_CWORD]}"*) + COMPREPLY[${#COMPREPLY[@]}]=$pid + ;; + esac + done < <( { + compgen -A job -P% + pgrep -u "$USER" . + } 2>/dev/null ) +} +complete -F _kill kill |