2

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#trap :

trap n [condition...] trap [action condition...]

If the first operand is an unsigned decimal integer, the shell shall treat all operands as conditions, and shall reset each condition to the default value. Otherwise, if there are operands, the first is treated as an action and the remaining as conditions.

If action is '-', the shell shall reset each condition to the default value.

What is the trap n syntax for? Isn't it basically the same things as trap -?

  • 1
    Likely for Bourne shell compatibility. Bourne shell didn't support the - action. To reset traps, the man page just said to omit the action. – Mark Plotnick Jul 6 '17 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.