Subject: sh exit trap problem
To: None <current-users@netbsd.org>
From: Wolfgang S. Rupprecht <wolfgang+gnus20050110T112023@dailyplanet.dontspam.wsrcc.com>
List: current-users
Date: 01/10/2005 11:34:48
Under bash, when one types a ^C to terminate the following script the
echo outputs echo-ed msg as expected.  Under sh, nothing happens other
than the shell script terminating immediately.  Is this a bug or
simply undefined behavior that sh is implementing differently?

    #!/bin/sh
    # this sets the handler correctly in bash, but not in /bin/sh
    trap "echo caught pseudo-sig EXIT" 0
    sleep 3

-wolfgang