zsh-users
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Ray Andrews <rayandrews@eastlink.ca>, zsh-users@zsh.org
Subject: Re: newline grief
Date: Sat, 10 Feb 2018 21:36:34 +0000	[thread overview]
Message-ID: <1518298594.2991411.1266528248.39443316@webmail.messagingengine.com> (raw)
In-Reply-To: <a43d273c-8f7b-e38b-e9b1-e3afd546ad53@eastlink.ca>

Ray Andrews wrote on Sat, 10 Feb 2018 13:04 -0800:
> On 10/02/18 11:54 AM, Daniel Shahaf wrote:
> > Eric Cook wrote on Sat, 10 Feb 2018 14:46 -0500:
> >> for aa in "${(f)$(typeset -m 'var*')}"; do
> > There's an API for this information:
> >
> > for parameter_name in ${(k)parameters[(I)var*]} ; do
> >
> >
> What do you mean "an API"?  Application Program Interface ??

Yes.  ${parameters} is an interface, as opposed to parsing the output
of `typeset` which isn't designed to be used this way (it's designed to
be eval'd).

> $ for parameter_name in ${(k)parameters[(I)var*]} ; do set $
> {parameter_name}=; done
> 
> ... arbitrary list of variables all nulled.  This could be useful for 
> cleaning up after some messy function.

That will set them to empty.  If you want to unset them you can use
'... do unset ${parameter_name}; done', but at that point just 'unset -m
"var*"' would be equivalent and more efficient.

And you should complain to the author of that function to declare his
variables local, see WARN_CREATE_GLOBAL :-)

Cheers

Daniel


  reply	other threads:[~2018-02-10 21:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10 19:02 Ray Andrews
2018-02-10 19:36 ` Bart Schaefer
2018-02-10 19:38   ` Eric Cook
2018-02-10 19:46 ` Eric Cook
2018-02-10 19:54   ` Daniel Shahaf
2018-02-10 20:09     ` Eric Cook
2018-02-10 21:07       ` Ray Andrews
2018-02-10 21:04     ` Ray Andrews
2018-02-10 21:36       ` Daniel Shahaf [this message]
2018-02-10 22:47         ` Ray Andrews
2018-02-10 20:36   ` Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1518298594.2991411.1266528248.39443316@webmail.messagingengine.com \
    --to=d.s@daniel.shahaf.name \
    --cc=rayandrews@eastlink.ca \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).