On 25/03/24 17:12, Oğuz wrote:
On Monday, March 25, 2024, Gioele Barabucci <gio...@svario.it
<mailto:gio...@svario.it>> wrote:
If a function does not set a trap, `trap` will output the command
set by the caller. This is just a cosmetic issue, the right trap
will be run at runtime.
Doesn't POSIX allow this? How else do you propose we save the trap set
for an event into a variable if `x=$(trap)' stops working?
Just for reference, neither dash nor busybox sh preserve the caller's trap:
trap in f1:
f1 output: <>
trap in f2 (initial):
trap in f2 (final):
f2 output: <f2>
main
Regards,
--
Gioele Barabucci