zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: trap question
Date: Fri, 25 Nov 2022 15:25:38 -0800	[thread overview]
Message-ID: <d765b639-1a21-03db-78a7-dae0bdef8ae2@eastlink.ca> (raw)
In-Reply-To: <CAN=4vMoT--+fknaDpjQJ8i4SadTVV=30GTvA6DL-fEwMvB-cuw@mail.gmail.com>


On 2022-11-25 10:57, Roman Perepelitsa wrote:
> Try replacing this:
>      trap " [[ $var == '0' ]] && echo trap: var is: $var" EXIT
>
> with this:
>
>      trap ' [[ $var == 0 ]] && echo trap: var is: $var' EXIT
>
Bullseye.  And I understand it I think.  Double quotes evaluated when 
parsed, single quotes kept as literal until trap is sprung, yes?  It 
wouldn't have occurred to me since I'd have expected the '$var' to 
remain un-expandable within single quotes.  Is this an exception or 
somehow to be viewed as routine?  BTW, will this trap catch exiting 
errors or just proper returns?  I know it doesn't catch ^C.




  reply	other threads:[~2022-11-25 23:27 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
2022-11-25 23:25   ` Ray Andrews [this message]
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=d765b639-1a21-03db-78a7-dae0bdef8ae2@eastlink.ca \
    --to=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).