Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: (z) expansion flag do not always return an array
- X-seq: zsh-users 27384
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Vincent Bernat <bernat@xxxxxxxx>
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: (z) expansion flag do not always return an array
- Date: Mon, 29 Nov 2021 17:34:14 +0100
- Archived-at: <https://zsh.org/users/27384>
- In-reply-to: <m3k0grdlls.fsf@luffy.cx>
- List-id: <zsh-users.zsh.org>
- References: <m3k0grdlls.fsf@luffy.cx>
On Mon, Nov 29, 2021 at 4:32 PM Vincent Bernat <bernat@xxxxxxxx> 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author