zsh-workers
 help / Atom feed
* $+var and (P) flag
@ 2019-05-27 19:45 Sebastian Gniazdowski
  2019-05-27 19:52 ` Roman Perepelitsa
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Gniazdowski @ 2019-05-27 19:45 UTC (permalink / raw)
  To: Zsh hackers list

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: $+var and (P) flag
  2019-05-27 19:45 $+var and (P) flag Sebastian Gniazdowski
@ 2019-05-27 19:52 ` Roman Perepelitsa
  2019-05-31 11:00   ` Sebastian Gniazdowski
  0 siblings, 1 reply; 3+ messages in thread
From: Roman Perepelitsa @ 2019-05-27 19:52 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 599 bytes --]

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@gmail.com> 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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: $+var and (P) flag
  2019-05-27 19:52 ` Roman Perepelitsa
@ 2019-05-31 11:00   ` Sebastian Gniazdowski
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Gniazdowski @ 2019-05-31 11:00 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

Thanks!

pon., 27 maj 2019, 21:52 użytkownik Roman Perepelitsa <
roman.perepelitsa@gmail.com> napisał:

> 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@gmail.com> 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
>>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-27 19:45 $+var and (P) flag Sebastian Gniazdowski
2019-05-27 19:52 ` Roman Perepelitsa
2019-05-31 11:00   ` Sebastian Gniazdowski

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/ public-inbox