Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Split on unquoted space
- X-seq: zsh-users 23685
- From: Jesper Nygårds <jesper.nygards@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Split on unquoted space
- Date: Fri, 28 Sep 2018 10:29:21 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=O0UvowSbM9t/oD5PHfp0k49ODjB1QtlWJ3U90l7cOkI=; b=G3/J6InV1jxbbqOSxF7sk6PK+xo8gE8rLSCuHJ03Vxeqq85DudYCIrHUD686M7gGpK 8BtFfvOyz77PWgCglLY6ez98NDR/rdmiCxshCclhLsZ72gTuZbLzayM6m30dk2Dje5yh kEyLgfBgFgjhuI2Vah1ILNtRausl4uv3YWN5F86isIaQiVyN3vc4HZTGNZX/U7vGc7YD EoBhy3+2Q2n0uzU3yNzEGWmAee++itVA2JqXop1IoN6GEl5KdgT7I5TRJWb4kOTViW3m ob+h2fKABqLH8x6ZyFGaOGQ2qXr7pdObmmUnxa4zCGQ4fE/GgExVUlmNObBAye+SM6h4 +FWA==
- In-reply-to: <CABZhJg8AU-U2xbwYLwMRVB4Q=sizTxDK3ZirjfqEEZUrf-_dYg@mail.gmail.com>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <CABZhJg8AU-U2xbwYLwMRVB4Q=sizTxDK3ZirjfqEEZUrf-_dYg@mail.gmail.com>
Never mind, this was indeed a problem I did not really have: I had
prematurely joined an array into a string, and then wanting to split the
string caused my problem. Not joining the array in the first place was the
obvious solution.
On Fri, Sep 28, 2018 at 9:22 AM Jesper Nygårds <jesper.nygards@xxxxxxxxx>
wrote:
> This might well be a case of me not understanding my problem, but is there
> a way to use parameter expansion to split only on unquoted spaces?
>
> If I have myvar="my\ string", ${=myvar} results in "my\" and "var", i.e.
> zsh doesn't care about the fact that the space is quoted.
>
> On the other hand, myvar="my\ var", ${(z)myvar} does respect the quoted
> space and makes no split, but then myvar="my|var", ${(z)myvar} results in
> "my" "|" "var", which is not what I want in this case.
>
> So in short, is there a way to only split on space, but not split on a
> quoted space?
>
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author