zsh-users
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: trap question
Date: Fri, 25 Nov 2022 19:57:23 +0100	[thread overview]
Message-ID: <CAN=4vMoT--+fknaDpjQJ8i4SadTVV=30GTvA6DL-fEwMvB-cuw@mail.gmail.com> (raw)
In-Reply-To: <e3382835-c9a6-a304-b8df-31700759844f@eastlink.ca>

On Fri, Nov 25, 2022 at 7:36 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> So what I'm really wanting is some way to set the trap in such a
> way that it responds to the value of 'var' *at the time of the springing
> of the trap*, namely at 'return'.  Can it be done?

Try replacing this:

    trap " [[ $var == '0' ]] && echo trap: var is: $var" EXIT

with this:

    trap ' [[ $var == 0 ]] && echo trap: var is: $var' EXIT

Roman.


  reply	other threads:[~2022-11-25 18:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-25 18:35 Ray Andrews
2022-11-25 18:57 ` Roman Perepelitsa [this message]
2022-11-25 23:25   ` Ray Andrews
2022-11-26  1:57     ` Bart Schaefer
2022-11-26  4:25       ` Philippe Altherr
2022-11-26  4:27       ` Ray Andrews
2022-11-26  4:49         ` Lawrence Velázquez
2022-11-26  4:50         ` Bart Schaefer
2022-11-26 15:03           ` Ray Andrews
2022-11-26 15:25             ` Roman Perepelitsa
2022-11-27  1:49               ` Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAN=4vMoT--+fknaDpjQJ8i4SadTVV=30GTvA6DL-fEwMvB-cuw@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).