Sujet : Re: Basta: protecting $_ variable.
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.unix.shellDate : 10. Apr 2024, 14:26:47
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240410061038.707@kylheku.com>
References : 1 2
User-Agent : slrn/pre1.0.4-9 (Linux)
On 2024-04-10, Janis Papanagnou <janis_papanagnou+
ng@hotmail.com> wrote:
On 10.04.2024 07:29, Kaz Kylheku wrote:
[...]
The trap setup for catching the SIGWINCH and SIGALRM signals now looks
like this:
trap 'basta_uln_save=$_; basta.update_status; : "$basta_uln_save"' ALRM WINCH
instead of just
trap basta.update_status ALRM WINCH
>
I know that this looks like a hack, but since 'update_status' needs no
arguments you could also more simply just write...?
>
trap 'basta.update_status "$_"' ALRM WINCH
>
(Not sure whether introducing a global variable and supplementary code
or this hack is "better". Just mentioning it for a possible variant.)
Nice streamlining; I changed to this.
One command, and no extra variable is better.
-- TXR Programming Language: http://nongnu.org/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca