Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: `=' expansion causes script/subshell to exit, bug?
- X-seq: zsh-workers 43578
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Vasiliy Ivanov <beelzebubbie.logs@xxxxxxxxx>
- Subject: Re: `=' expansion causes script/subshell to exit, bug?
- Date: Fri, 28 Sep 2018 00:38:15 +0200
- Cc: "zsh-workers@xxxxxxx" <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=NoZaT37C4eK+/l8l2TTUUeWVwxAa0WE4IB/5g8ELEUc=; b=s2zwBzyUjvorkpmBybTzEFMwhUBaTNdX5u2XNwkN+EwdIk2yJX5X7nQOG4cuapGT/X PbKniUg0SL7ZGXyoDdcpgnQMH0NfqGlE3clPW2M9Vw28x01GuY7iC4aSKPVLdCxeRmzt 3gKitdEU+4+JsOYAksWh7oN0hGR7IsRknhXW7HfUyisT4Qr2+5KZRQU1UAaA3LAJpzW0 ltMImlEn4qRbTcKDqNkJXaNfpJ+Nr6NOW+Mudpz6aZCpMmiA7UgAbQ3RLC71x843zJ4K gsMR7MBRxHdvdP5skNDprUY8F01O+Pu01lArW6YQoJcqA8821yiWEk8KjsKP+Y2NKWag 1uuQ==
- In-reply-to: <16141d86-9d3e-275f-f7b4-d8b07fc97aa7@gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <16141d86-9d3e-275f-f7b4-d8b07fc97aa7@gmail.com>
On Thu, Sep 27, 2018 at 9:20 PM, Vasiliy Ivanov
<beelzebubbie.logs@xxxxxxxxx> wrote:
> Hello. Recently I've seen that line like
>
> [[ -x =somebinary ]] || cmd
>
> causes script to exit unexpectedly with message like «/path/to/script:$line: =somebinary not found»,
> instead of invoking || cmd and continue executing
>
> some simple tests:
>
> % ( [[ -x =123123 ]] || { print 'ohshi'; exit 2 } )
> zsh: 123123 not found <exit code 1>
>
> % ( b=123123; print =$b; print 'ohshi' ) ↑
> zsh: 123123 not found
>
> Is it intended behaviour?
>
> % zsh --version
> zsh 5.6.2 (x86_64-pc-linux-gnu)
If you don't want to change any options, you can also use this
construct to avoid exiting without a subshell,
% { [[ -x =somebinary ]] } always { TRY_BLOCK_ERROR=0 } || echo hey
zsh: somebinary not found
hey
I also have this in my .zshrc
alias always_continue='always { TRY_BLOCK_ERROR=0 }'
so I can do just
% { [[ -x =somebinary ]] } always_continue || echo hey
zsh: somebinary not found
hey
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author