help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Find out trap ERR from within a function when errtrace i


From: Chet Ramey
Subject: Re: [Help-bash] Find out trap ERR from within a function when errtrace is unset?
Date: Wed, 25 Feb 2015 13:25:20 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 2/25/15 10:31 AM, Patrick Schleizer wrote:
> Hi!
> 
> TLDR:
> 
> If errtrace is not in use, and one is within a function, is it possible
> from within the function to find out which trap ERR is set on global level?

No, unless you have saved any existing trap into a variable that you can
interrogate from within the function.  That's the reason for errtrace:
to allow a way to circumvent the usual ERR trap inheritance rules.  Bash
functions don't have local trap state otherwise.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]