Thanks Clark, that isclear. I hadn't thought to look at the ksh man page for trap. However, the trap manual is not clear about this behaviour and could do with updating. Currently (Version jM 93u 2011-02-08) it only states: "If action is -, trap resets each condition to the default value. If action is an empty string, the shell ignores each of the conditions if they arise. "

Cheers, Gerald

On 19/08/2014 8:35 p.m., clarkw wrote:
On Tue, Aug 19, 2014 at 10:54 AM, gerald cato <[email protected] <mailto:[email protected]>> wrote:

    Hi,

    I've noticed inconsistent behavior between trap <number> vs trap
    <name> when action is null.  For example:

    $ Version jM 93u 2011-02-08

    $ trap '' 0
    $ trap 0
    $ trap '' exit
    $ trap exit
    ksh: trap: condition(s) required

    $ trap '' 1
    $ trap 1
    $ trap '' HUP
    $ trap HUP
    ksh: trap: condition(s) required
    $


According to the ksh(1) manual (Version jM 93u 2011-02-08), "If /action/ is omitted and the first /sig/ is a number, or if /action/ is -, then the trap(s) for each /sig/ are reset to their original values". So both `trap exit' and `trap HUP' are invalid commands as "exit" and "HUP" are not numbers.

-clark


    $ Version M-11/16/88i
    $ trap '' exit
    $ trap '' 0
    $ trap exit
    $ trap 0

    Not sure if this has been fixed in a later release.

    Cheers, Gerald


    _______________________________________________
    ast-developers mailing list
    [email protected]
    <mailto:[email protected]>
    http://lists.research.att.com/mailman/listinfo/ast-developers





_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to