help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash trap do for specific certain code lines


From: Greg Wooledge
Subject: Re: Bash trap do for specific certain code lines
Date: Sat, 15 Jul 2023 19:26:48 -0400

On Sun, Jul 16, 2023 at 06:18:29AM +0700, Budi wrote:
> How can we have Bash trap to mean certain specific bash code lines only

Set the trap before the lines in question, and remove it afterward.

trap: trap [-lp] [[arg] signal_spec ...]
    [...]
    ARG is a command to be read and executed when the shell receives the
    signal(s) SIGNAL_SPEC.  If ARG is absent (and a single SIGNAL_SPEC
    is supplied) or `-', each specified signal is reset to its original
    value.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]