Deutsch   English   Français   Italiano  
<20240410061038.707@kylheku.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.unix.shell
Subject: Re: Basta: protecting $_ variable.
Date: Wed, 10 Apr 2024 13:26:47 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <20240410061038.707@kylheku.com>
References: <20240409222039.303@kylheku.com> <uv5bf2$psbu$1@dont-email.me>
Injection-Date: Wed, 10 Apr 2024 13:26:47 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="a02df6af16e190f6c7ee895d512b8f84";
	logging-data="1043687"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+MQvluy1lFB10ZyafG+XfHNFolBmerWDo="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:j+oxP7DLUGULXNINwhQmP4OxGN4=
Bytes: 1822

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/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca