Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: SUGGESTION: kill -l could show numbers, too



On Thu, Nov 18, 2004 at 08:33:04AM -0800, Bart Schaefer wrote:
[...]
> Which can be rewritten as a wrapper, and without the pipe to "pr":
> 
>   kill() {
>     case $1 in
>     (-l)
>       integer i=0
>       print -c ${(e)signals//*/\$((i++))\) SIG\$signals[\$i]}
>       ;;
>     (*)
>       command kill "$@"
[...]

Rather:

builtin kill "$@"

And you need to check the number of arguments (for kill -l TERM
for instance)

kill() {
  if (( $# == 1 )) && [[ $1 = "-l" ]]; then
    integer i=0
    print -rc ${(e)signals//*/\$((i++))\) SIG\$signals[\$i]}
  else
    builtin kill "$@"
  fi
}

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author