[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: reset a trap upon use
From: |
Chet Ramey |
Subject: |
Re: reset a trap upon use |
Date: |
Fri, 24 Nov 2023 12:16:37 -0500 |
User-agent: |
Mozilla Thunderbird |
On 11/24/23 12:07 PM, bill-auger wrote:
great explanation Koichi - thanks - i did not learn anything about the scoping
or inheritance by reading `info bash trap` or by searching the web
This is from the FUNCTIONS section of the man page. The info document
contains the same language.
"All other aspects of the shell execution environment are identical be-
tween a function and its caller with these exceptions: the DEBUG and
RETURN traps (see the description of the trap builtin under SHELL
BUILTIN COMMANDS below) are not inherited unless the function has been
given the trace attribute (see the description of the declare builtin
below) or the -o functrace shell option has been enabled with the set
builtin (in which case all functions inherit the DEBUG and RETURN
traps), and the ERR trap is not inherited unless the -o errtrace shell
option has been enabled."
The `.' builtin behaves the same way.
- i mainly
just wanted to understand the behavior, verify that the original author of this
code also misunderstood the behavior, or to report a bug if it was behaving
unexpectedly
These `signals' came in with bash debugger support, and these semantics are
what the debugger needs.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/