Harald van Dijk <a...@gigawatt.nl> wrote, on 29 Jul 2020: > > On 29/07/2020 09:45, Geoff Clare wrote: > > It's only easy because (most/all?) shells take the easy option and do > > a lexical analysis of the command to be substituted. > > trap (without -p) in a command substitution prints the trap actions of the > parent shell in bash, busybox ash, gwsh, ksh and yash. Of these, only > busybox ash does it by lexical analysis.
Perhaps things have changed since 2009 when this first came up, but (as I reported in bug 53) at that time, ksh93 was the only shell I could find which handled things like: var=trap; save_traps=$($var) and save_traps=$(trap; true) correctly. -- Geoff Clare <g.cl...@opengroup.org> The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England