help / color / mirror / code / Atom feed
From: Eric Cook <llua@gmx.com>
To: zsh-users@zsh.org
Subject: Re: Use of { try-list } always { always-list } with "set e-"
Date: Sat, 17 Jul 2021 16:07:38 -0400	[thread overview]
Message-ID: <41ebee57-b2e9-b185-93e2-8861d2387f57@gmx.com> (raw)
In-Reply-To: <CAMP9c5nKDwnq_FTYB8x=Og=pUfmd5t7aMnkDLs_CAF2JuJ+OAA@mail.gmail.com>

On 7/17/21 9:03 AM, Zach Riggle wrote:
> set -e
> () {
>      {
>          echo TRY
>          false
>      } always {
>          echo ALWAYS
>      }
> }

set -e, as well meaning as the intention was, will always interactive with non posix features in weird ways.
it is pretty much always better to explicitly handle errors that need to abort the entire script instead of
relying on set -e. once you are writing conditional logic, if, while, {} always {}, etc, all bets are off on
how set -e will handle it.

      reply	other threads:[~2021-07-17 20:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-17 13:03 Zach Riggle
2021-07-17 20:07 ` Eric Cook [this message]

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:

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

  git send-email \
    --in-reply-to=41ebee57-b2e9-b185-93e2-8861d2387f57@gmx.com \
    --to=llua@gmx.com \
    --cc=zsh-users@zsh.org \


* 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


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).