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

Re: SUGGESTION: kill -l could show numbers, too (+CLD vs CHLD)



On Thu, Nov 18, 2004 at 04:05:17PM +0000, Peter Stephenson wrote:
> Christian =?iso-8859-1?Q?H=F6ltje?= wrote:
> > I have a suggestion for the kill builtin:
> > 
> > It would be nice if when you did '-l' to show the list of signal
> > that it show the signal number.
> 
> Not quite as convenient, but try this function:
> 
> kill-l() {
>   for i in {1..$#signals}; do
>     print $((i-1))\) SIG$signals[$i]
>   done | pr -t5
> }
[...]

Or, to avoid "pr":

kill-l () {
        local -a s
        for i in {1..$#signals}
        do
                s[i]="$((i-1))) SIG$signals[$i]"
        done
        print -C5 $s
}

BTW, I noted some discrepancies on the result of kill -l between
various shells and /bin/kill on that Linux-i386:

bash    bin     csh     dash    ksh     pdksh   zsh     

ABRT    ABRT    ABRT    ABRT    IOT     ABRT    ABRT
        STKFLT  STKFLT  16      SIG16   STKFLT  STKFLT
CHLD    CHLD    CHLD    CHLD    CHLD    CHLD    CLD
IO      POLL    POLL    IO      POLL    IO      POLL
SYS     SYS     SYS     SYS     SYS     UNUSED  SYS


Why SIGCLD and not SIGCHLD for zsh?

SUSv3 (POSIX) seems to require SIGCHLD
http://www.opengroup.org/onlinepubs/009695399/basedefs/signal.h.html
http://www.opengroup.org/onlinepubs/009695399/utilities/trap.html

-- 
Stéphane



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