zsh-users
 help / color / mirror / code / Atom feed
From: Roman Perepelitsa <roman.perepelitsa@gmail.com>
To: Vincent Bernat <bernat@luffy.cx>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: (z) expansion flag do not always return an array
Date: Mon, 29 Nov 2021 17:34:14 +0100	[thread overview]
Message-ID: <CAN=4vMpHw6m23qLyy3kurDgXvs1nRW6XAs3FEUQc7wX-Jpzysw@mail.gmail.com> (raw)
In-Reply-To: <m3k0grdlls.fsf@luffy.cx>

On Mon, Nov 29, 2021 at 4:32 PM Vincent Bernat <bernat@luffy.cx> wrote:
>
> Is there an easy way to know if something is an array or a string?
> I am  using subscripting for that but maybe there are better ways.

If you had a parameter, you could use ${(t)foo} or $parameters[foo] to
find its type. However, if you had a parameter you wouldn't have this
problem to begin with.

  foo=(${(z)...})

Here foo is always an array.

Roman.


  reply	other threads:[~2021-11-29 16:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 15:31 Vincent Bernat
2021-11-29 16:34 ` Roman Perepelitsa [this message]
2021-11-29 17:44   ` Vincent Bernat
2021-11-29 16:50 ` Lawrence Velázquez
2021-11-29 17:03   ` Peter Stephenson
2021-11-29 17:43   ` Vincent Bernat
2021-11-29 17:45   ` Bart Schaefer
2021-11-29 19:43 ` 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=4vMpHw6m23qLyy3kurDgXvs1nRW6XAs3FEUQc7wX-Jpzysw@mail.gmail.com' \
    --to=roman.perepelitsa@gmail.com \
    --cc=bernat@luffy.cx \
    --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).