bug-bash
[Top][All Lists]
Advanced

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

Re: return exit code in EXIT trap


From: Robert Elz
Subject: Re: return exit code in EXIT trap
Date: Sun, 07 Aug 2022 01:44:59 +0700

    Date:        Sat, 6 Aug 2022 12:02:07 -0400
    From:        "Robert E. Griffith" <bobg@junga.com>
    Message-ID:  <5a091673-5e70-baee-0874-1c8c5ec8824e@junga.com>

  | Where can we use 'return' directly in a trap script? What am I not getting?

I suspect that if you want specified behaviour, the answer is nowhere.

However, almost all shells extend (one way or another) the places where
return/break/continue can be used beyond what is specified in the standard.
It just is done differently.

It is possible (and seems so, from messages in this thread) that bash allows
a return in the trap string (not in a function called in that string) if the
trap occurs while executing a function (then the return applies to that
function).

kre




reply via email to

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