On Jun 25 2026, Léa Gris wrote:
> Le 25/06/2026 à 00:36, Gregory Heytings écrivait :
>> Is this better than
>> trap_append () { trap "$(printf "%s\n$1" "$(trap -P "$2")")" "$2"; }
>> trap_prepend () { trap "$(printf "$1\n%s" "$(trap -P "$2")")" "$2"; }
>
> While effective, these functions rely on subshells for serialization and
> re-parsing, introducing unnecessary overhead and reduced readability due
> to the density required for quoting and string manipulation.
trap_append () { trap "$(trap -P "$2")
$1" "$2"; }
trap_prepend () { trap "$1
$(trap -P "$2")" "$2"; }
--
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."