Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: more splitting
- X-seq: zsh-users 30572
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: more splitting
- Date: Tue, 14 Apr 2026 23:14:51 -0700
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6ahAtTuueOihL8p56i1eDl+fNIPPPNE7MvdOCMIA1eQ=; fh=yk3c4scJWo86Za4IR1HBNZw2a+GkUkfVQ7Fs3jnanfg=; b=ECu4HNxXMYsQgAMvwPK0PhAxy5znoaGtlQ/Ti4VNIsO3cMLC0rfpQ66mQwOjvx9p3c TxoGxTAffnvQG1v55YWRFKZXG8NRKGvJItCWin3BA1KJEFafUgpJ7GURQwz02HdFXFqY 2wMteZ8TVoyU/mR3UiIt9s1QKQW5FPHKYGIqeSGplPmtN9h1xpPbsKOJuWvfZatnT25o z/Z1yaQy1h4IzpLLMj6tIPsdvLqbVptwGirV/wcl5cRJjIlEf2LWbl3VMSdJFcg4yZH4 TIZQvO9oAMrrmFlhZ+3KRnP98aKP6iQc5eebqtINpQJQ617GKUMfURHozCWc1JEfjAF1 rvFg==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1776233703; cv=none; d=google.com; s=arc-20240605; b=RLOR6hU+JryjAzKMcU/gAPh1ExeQNB2QUu9zM0oElBHWvooHqh1/7vgJ0NO+f7x9Yl 393Jl1OXnDakCn8veOycLxtdpqLFYxayqEzDQiAKaQCJnUNTKe8eUB9+iP7wZuZJqAAD v32VtO1cj68ldPDSj4tkzQXi3eT7xzkmaKZyPr1PE+y331H8rz+8M9d6CUddZjTuP8VQ CFFCvtGFHEhSbcCsqne5VlluSkW/yn5q2k/SUH1+1XWTm5I2Z37lhbzMBRLB8AaM0Fj7 6tD7zHO9QAgYniOqU5I+lKjLpLrCI1fKzjVzywnfZgoS6FTDsJX/g5HevN1k1aEFNXWA i/iw==
- Archived-at: <https://zsh.org/users/30572>
- In-reply-to: <d570a3b2-dd2c-4110-a010-b106476af251@eastlink.ca>
- List-id: <zsh-users.zsh.org>
- References: <711e5b5f-5bd3-44e5-87a7-e18b0d670ae5@eastlink.ca> <CAGdYchuXfLZNBY2r8ztKuBrP17BN9UZ-jy_pOXtTHUesyMCL3Q@mail.gmail.com> <d570a3b2-dd2c-4110-a010-b106476af251@eastlink.ca>
On Tue, Apr 14, 2026 at 6:54 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2026-04-14 16:24, Philippe Altherr wrote:
> >
> > Below is a version where both, 'hex $var' and 'print -rN $var |
> > hex', produce the same result. It expects the stdin to contain strings
> > separated by NUL characters. That's why the print call has to use the
> > -N option to join its arguments with NUL characters instead of spaces.
> Your version seems good but I'm still trying to understand exactly
> what's going on. Split on nuls you say. [...] But, if it's split on
> nuls, where are they? [...] Or ... have you
> cleverly managed to add them and then remove them, leaving the data
> exactly as found?
They were removed by ${(0)...}. I said "You can add things to the
stream that can later be interpreted as semantics, but then you also
have to provide the interpreter." In Philippe's implementation,
"print -rN" adds NULs, and ${(0)...} is the interpreter that uses them
as semantics and therefore removes them again.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author