Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: $+var and (P) flag
- X-seq: zsh-workers 44368
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- Subject: Re: $+var and (P) flag
- Date: Mon, 27 May 2019 21:52:21 +0200
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6gyl87LDRldBw+7xX9f4Sy+EZlzacjAgMREverWaHlg=; b=FmLYy69I8oZJkLxm9kic6zxKbAmpfWERDraLanNXrI1ypZQiKpQwjaacWrn7Jl+SMo jfrzcr17cwvRA88IhqrNAyYHB1QKFJdSpOkwNg+2zdiVBTJmtfH9iaakZlCX7Hu1W9D2 VwXbLO2eUiJ1UWMWW23UVFQrclZdXkd9rViueBtg6lmM0PqT5XwJYaww5icSWO+JdGIo erQrAOc12tUK0ktklqz8PDt7XYsedrodRAJN5hoSxzuDdtUPd36nOyOkGN+KTOQt37QC uUwcJk/MjZxjLA78HOJWEScrvAGC8gHTi4XsA6ySsCFY94pbLYlcnycVM1nhiM4S16KS BGew==
- In-reply-to: <CAKc7PVDp3rKdjrzXeHxiqC15TBSfbgG-rc-t6_p1=3FPyf28Wg@mail.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: <CAKc7PVDp3rKdjrzXeHxiqC15TBSfbgG-rc-t6_p1=3FPyf28Wg@mail.gmail.com>
You can try [[ -v ${varname:1} ]] and (( $+parameters[${varname:1}] )).
${varname:1} removes the leading plus. If you can change your code so that
the plus isn't added, it gets simpler.
Roman.
On Mon, May 27, 2019 at 9:46 PM Sebastian Gniazdowski <
sgniazdowski@xxxxxxxxx> wrote:
> Hello,
> simple test:
>
> a=1
> varname='+a'
> echo ${(P)varname}
>
> yields empty output. Is there any way to use the $+var syntax with (P)
> flag?
>
> --
> Sebastian Gniazdowski
> News: https://twitter.com/ZdharmaI
> IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
> Blog: http://zdharma.org
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author