From: Ray Andrews <rayandrews@eastlink.ca>
To: zsh-users@zsh.org
Subject: Re: trap question
Date: Sat, 26 Nov 2022 07:03:15 -0800 [thread overview]
Message-ID: <0587d081-5941-2634-80f2-69ed537de651@eastlink.ca> (raw)
In-Reply-To: <CAH+w=7aVC3RPbbiAhBvjoZHeD1--EkYapQr4GNYHUP-iQB6Q4A@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1341 bytes --]
On 2022-11-25 20:50, Bart Schaefer wrote:
> No, it should not be on. I was giving an example of an error where an
> exit trap would be tripped, not implying that you want that condition
> to be an error. If a command returning false is an error you should
> be explicitly handling that and doing a normal return/exit.
>
Eventually sure, but when things are unstable it's at least nice to have
zcurses powered down under control, no? I'll set that option and see
what transpires.
Lawrence:
It's not a special case, just like "eval" isn't a special case.
I'd put it the other way: trap and eval are both special cases, no? Surely the general rule is that nothing is ever expanded within single quotes?
Now, if you use single quotes instead of double quotes, the first
argument of the trap command expands to the string [[ $var == '0' ]] &&
echo trap: var is: $var, which looks like a much more interesting
command to execute when the EXIT trap triggers ;-)
Philippe
Ok, that makes nothing but sense. The single quotes do what single
quotes do, *but* there is also the intuitive way that the trap is always
'in reserve' -- it never does anything when/where written, only when
sprung, so at that time the quotes are gone and the variable expands to
it's value in real time. Got it. It's sorta like compiled code.
[-- Attachment #2: Type: text/html, Size: 2328 bytes --]
next prev parent reply other threads:[~2022-11-26 15:04 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
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 [this message]
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=0587d081-5941-2634-80f2-69ed537de651@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).