[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Trick for saving and restoring $_ in trap handler.
From: |
Koichi Murase |
Subject: |
Re: Trick for saving and restoring $_ in trap handler. |
Date: |
Wed, 10 Apr 2024 17:23:41 +0900 |
2024年4月10日(水) 14:17 Kaz Kylheku <kaz@kylheku.com>:
> trap 'uln_save=$_; handler; : "$uln_save"' ALRM
I would do
trap 'handler "$_"' SIGXXX
In this way, we don't have to care about possible conflicts of the
variable name to save the value. Doesn't this work in your case of
ALRM? (Maybe you have a special setup because we usually don't have the
access to alarm(2) or setitimer(2) from the Bash script.)