help-bash
[Top][All Lists]
Advanced

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

A typo in Bash manual and how to have a "local" trap instruction


From: Laurent Lyaudet
Subject: A typo in Bash manual and how to have a "local" trap instruction
Date: Thu, 19 Mar 2026 16:02:55 +0100

Hello :),

I'm trying to make better use of trap builtin.
I read everything related in the manual,
and saw this missing closing parenthesis:
----------------
3.7.6 Signals
...
The trap builtin modifies the shell’s signal handling, as described
below (see Bourne Shell Builtins.
----------------
I wanted to provide a patch but cloning of bash repository is still ongoing,
and maybe a patch for a single character would be ridiculous.

Now, my true question: How to have something like a "local" trap
instruction on RETURN sigspec ?
I did some testing and the interactive shell RETURN trap is
overwritten by the one of a shell function.
How to make both impermeable without using a subshell ?
Right now, I'm thinking about having a single trapped command on
RETURN that would be in my code, and that function would handle a
stack of trap instructions for functions,
and it would do the work of popping each instruction, executing it, etc.

I hope you may have nice solutions to this problem :).

Best regards,
    Laurent Lyaudet



reply via email to

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