* $+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, other threads:[~2019-05-31 11:01 UTC | newest] 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
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).