zsh-users
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Ray Andrews <rayandrews@eastlink.ca>
Cc: zsh-users@zsh.org
Subject: Re: associative array questions
Date: Tue, 13 Dec 2022 21:06:42 +0100	[thread overview]
Message-ID: <CAN=4vMrb_rUfKysnwNZ_MK12NsemohFwMcP-peXfzToAfWF6Og@mail.gmail.com> (raw)
In-Reply-To: <daff6a9f-df6c-cde1-cfac-c009deedca1d@eastlink.ca>

On Tue, Dec 13, 2022 at 9:01 PM Ray Andrews <rayandrews@eastlink.ca> wrote:
>
> On 2022-12-13 08:22, Roman Perepelitsa wrote:
>
> eval 'list=( "${(@M)list:#(#i)*$SEARCHBUF*}" )'     # filter the array.
>
> This eval will expand things that you don't want expanded. Use `set -A $list` instead.
>
> Roman.
>
> I think I'm missing something Roman,  can't make it work.  Tried a few variations:
>
> set -A $list=( "${(@M)list:#(#i)*$SEARCHBUF*}" )
> set -A $list=( "${(@M)${(P)list}#(#i)*$SEARCHBUF*}" )
> set -A $list=( "${(@M)${(P)1}#(#i)*$SEARCHBUF*}" )

`set` is a builtin (not a reserved word), so you use it like a normal
command. Your first email in this thread used it correctly. You can
also refer to `man zshbuiltins` for documentation.

> BTW is it possible to redirect the error messages and especially 'set -x' output?  All this is with zcurses active so the messages are hidden or chopped up.

Unlike bash, zsh cannot send xtrace output anywhere but to stderr. If
you redirect stderr, xtrace output will be redirected too.

Roman.


  reply	other threads:[~2022-12-13 20:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-11 17:39 Ray Andrews
2022-12-11 19:53 ` Bart Schaefer
2022-12-11 20:51   ` Ray Andrews
2022-12-11 21:41     ` Bart Schaefer
2022-12-11 22:37       ` Ray Andrews
2022-12-12  1:52         ` Bart Schaefer
2022-12-12  3:09           ` Ray Andrews
2022-12-13  3:31       ` Ray Andrews
2022-12-13  4:39         ` Bart Schaefer
2022-12-13 16:11           ` Ray Andrews
2022-12-13 16:22             ` Roman Perepelitsa
2022-12-13 20:00               ` Ray Andrews
2022-12-13 20:06                 ` Roman Perepelitsa [this message]
2022-12-13 22:47                   ` Ray Andrews
2022-12-13 23:06                     ` Bart Schaefer
2022-12-14  1:08                       ` Ray Andrews
2022-12-13 21:18             ` Bart Schaefer

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='CAN=4vMrb_rUfKysnwNZ_MK12NsemohFwMcP-peXfzToAfWF6Og@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --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).