Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Possible bug: Zsh function does not terminate when ${name:?word} fails
- X-seq: zsh-users 21906
- From: Ronald Fischer <ynnor@xxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>, "Zsh Mailing-List" <zsh-users@xxxxxxx>
- Subject: Re: Possible bug: Zsh function does not terminate when ${name:?word} fails
- Date: Wed, 14 Sep 2016 13:21:15 +0200
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=mm.st; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=Rd4BgK+RwXZ+1qPosPywJCsp4tM=; b=OUuXOG oIqAcY4lk2xaEJRlp2RPUsTPSbOyqrpc+iYalQk5MoHXEgXTufXO6js9LGkOSAl+ 1YY87KceiBzG/o0HhCJokZes2viOQGtumuNtYymtPP1XkY4VWRlM9syzeECfmSml RxdAaid1rgVLgfX0ZaNiuzlFnM1VkS7aPw4JI=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=Rd4BgK+RwXZ+1qP osPywJCsp4tM=; b=Xx2eF+S4z1aJLADig84FcA6QlsJOJ+3UVPGUATCoYeVtHEr Jsk1i8PO9UWuP4NFacUtxj9DyqgDs/Z6UKyvJP0gyKR0ywD5XVY7s+HePWq0VOqz deuzvaFlSlY80PbqsWJLRDycHnzB/cXHXzPW/Wv1Yw5Bxf7+bdT7isr/sLdg=
- In-reply-to: <CAHYJk3T+J8bkGmDxMbOBdFiY1EzsvYajG3tKEHRfJV9Bjk9RZw@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <1473840044.77968.725190513.460F8572@webmail.messagingengine.com> <CAHYJk3T+J8bkGmDxMbOBdFiY1EzsvYajG3tKEHRfJV9Bjk9RZw@mail.gmail.com>
> This seems to be a side effect of the reserved word handling, if you do
> disable -r local
> then it behaves as expected.
I don't think this would be a good idea. If I understand correctly, this
would make the variables global (with all consequences from a name
clash). There are other nasty consequences too.
A better workaround is IMO to separate parameter check and assignment,
for instance by
: ${foo:?hello}
local p=$foo # foo is guaranteed to have a value here
Ronald
Messages sorted by:
Reverse Date,
Date,
Thread,
Author