Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Use of { try-list } always { always-list } with "set e-"
- X-seq: zsh-users 26789
- From: Eric Cook <llua@xxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Use of { try-list } always { always-list } with "set e-"
- Date: Sat, 17 Jul 2021 16:07:38 -0400
- Archived-at: <https://zsh.org/users/26789>
- In-reply-to: <CAMP9c5nKDwnq_FTYB8x=Og=pUfmd5t7aMnkDLs_CAF2JuJ+OAA@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author