zsh-users
 help / color / mirror / code / Atom feed
* Weird error: opts[(r)-e]: parameter not set
@ 2016-10-29 14:14 Sebastian Gniazdowski
  2016-10-29 17:03 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Gniazdowski @ 2016-10-29 14:14 UTC (permalink / raw)
  To: zsh-users

Hello,
I do:
    local -a opts
    zparseopts -a opts -D ${(s::):-eLdgabsTtm}

    if [[ "${#opts[@]}" -eq 0 || ( "${#opts[@]}" -eq 1 &&
    "${opts[(r)-e]}" = "-e" ) ]]; then

and this at one user setup results in error:

functionname:12: opts[(r)-e]: parameter not set

Line number points to the if. Having set -u is capable of generating
such error, however not in this case, as there is `local -a opts`. What
else can do this?

-- 
  Sebastian Gniazdowski
  psprint@fastmail.com


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

* Re: Weird error: opts[(r)-e]: parameter not set
  2016-10-29 14:14 Weird error: opts[(r)-e]: parameter not set Sebastian Gniazdowski
@ 2016-10-29 17:03 ` Bart Schaefer
  2016-10-30 11:36   ` Sebastian Gniazdowski
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2016-10-29 17:03 UTC (permalink / raw)
  To: zsh-users

torch% () { setopt localoptions nounset; local -a foo; print $foo[3] }
(anon): foo[3]: parameter not set

The NO_UNSET option complains not just when the array itself is not
declared, but whenever there is a dereference of an array element
that does not exist.


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

* Re: Weird error: opts[(r)-e]: parameter not set
  2016-10-29 17:03 ` Bart Schaefer
@ 2016-10-30 11:36   ` Sebastian Gniazdowski
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Gniazdowski @ 2016-10-30 11:36 UTC (permalink / raw)
  To: zsh-users

On Sat, Oct 29, 2016, at 10:03 AM, Bart Schaefer wrote:
> torch% () { setopt localoptions nounset; local -a foo; print $foo[3] }
> (anon): foo[3]: parameter not set
> 
> The NO_UNSET option complains not just when the array itself is not
> declared, but whenever there is a dereference of an array element
> that does not exist.

I must have done something wrong when testing this, probably had "-e" in
the test array. Thanks, with Daniel's fix, the problem should be solved.

-- 
  Sebastian Gniazdowski
  psprint@fastmail.com


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

* Re: Weird error: opts[(r)-e]: parameter not set
       [not found] <1477750478.1339900.771127977.5B74E734__11319.806535221$1477750580$gmane$org@webmail.messagingengine.com>
@ 2016-10-29 17:01 ` Daniel Shahaf
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2016-10-29 17:01 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: zsh-users

Sebastian Gniazdowski wrote on Sat, Oct 29, 2016 at 07:14:38 -0700:
> functionname:12: opts[(r)-e]: parameter not set

(( ${+opts[(r)-e]} ))

avoids the error.


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

end of thread, other threads:[~2016-10-30 11:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-29 14:14 Weird error: opts[(r)-e]: parameter not set Sebastian Gniazdowski
2016-10-29 17:03 ` Bart Schaefer
2016-10-30 11:36   ` Sebastian Gniazdowski
     [not found] <1477750478.1339900.771127977.5B74E734__11319.806535221$1477750580$gmane$org@webmail.messagingengine.com>
2016-10-29 17:01 ` Daniel Shahaf

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).