Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: more splitting
- X-seq: zsh-users 30568
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: more splitting
- Date: Tue, 14 Apr 2026 20:26:55 -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:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=tJBGsP7QQ3C6KXkC0eQttuTqW1YxVPko8LvTFpGA5vo=; fh=D6X9xIaVjTSxb6gwuCseglo0uxyISp24IsyxMp5sRU4=; b=dKZhXn1/2Mr28ggNVOl+sOgu+6PWAQonGyaWId6PpJ9KnQXSEgLwmPkWNVrGz5XQdu M2eo0rOoLs81e5s2lRah9KL3MxxKbHH6gsXoRnZGY3yfOPlvYNf8TbAxRUpyZrQmHtCv Sg2Yk8mKYZUlHt2NCPspTuycG0s3Cc5DeSIYJwfK7P8HnGJT2PDKmX3+9KS2zLQaB62N XQ/g0CczySE3m4dScea/P9J8dI5x1tAMMdtNOU1DYAR21bWHeBlAnrDBmDBLBoBDkIox w8M+XxDzfj6X9igAt6lGkbJoLHV9MXow7LfpD7Q3kW54XiItw2Xomt+TI26tqhtJYSjT Ul8A==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1776223627; cv=none; d=google.com; s=arc-20240605; b=leMGRwPiFxEBhaGv9tckPATxTaAp+ivNwBxqDw2NKlDQdFfYY8pUL4FnsDuel9V2sh lG3d45jkUxPzlRd0pygcIytw+6YUYigvRQ5slmi3S/a1qVZRpP2olNp9DTMpCYEytryu eVo2RMYDBi1rEeLu8r/FWA1k89VIwfB3FRJgKwLdd0JfAZDUhj4MEaJBQo2Vbs3R/TR3 5UD6QFoo6WzAZy/hn6+Gosk6HTyjhKJsDSKHaohExF6nZwfzl5rXeyeC2+87eoyEm7ud yEvukjDfkE+3zDjTzmmOUdEyYHXwQEs9eu6NZHIbZE39LHs+kIReKxyjOe9loZb7ytCt jcCQ==
- Archived-at: <https://zsh.org/users/30568>
- In-reply-to: <19aa1276-5f07-4c9a-8c6f-0c460be587a1@eastlink.ca>
- List-id: <zsh-users.zsh.org>
- References: <711e5b5f-5bd3-44e5-87a7-e18b0d670ae5@eastlink.ca> <CAGdYchuXfLZNBY2r8ztKuBrP17BN9UZ-jy_pOXtTHUesyMCL3Q@mail.gmail.com> <CAH+w=7a1Z3T2+t5w5Y9_ODFwsDycWfejKSTL9aoukEHhqO8RxQ@mail.gmail.com> <19aa1276-5f07-4c9a-8c6f-0c460be587a1@eastlink.ca>
On Tue, Apr 14, 2026 at 7:45 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2026-04-14 19:02, Bart Schaefer wrote:
>
> Sheesh. I suppose it's naive, but one might have thought that whether a
> function gets it's input via the front door or the back door wouldn't
> matter very much.
This is sort of like saying you expect eating a handful of cookies to
be the same as eating a bowl of unbaked dough. (Sorry, that's about
as far as the analogy goes here.)
Arguments ($@) are a list of words that the shell has already divided
up. Pipes (and other sorts of file input) are a stream of bytes.
Some extra work has to be done to make the two appear the same before
you can compare them.
> print -rn ${(q+)var} | hex
>
> I'm not going to remember that in the real world.
If you redo 'hex' to accept the name of the variable instead of the
expansion of the variable, you can fix all of this:
function hex ()
{
local _hex_var element
echo
if [[ -p /dev/fd/0 ]]; then
read -d '' -r _hex_var
else
_hex_var=$1
fi
set -- ${(P)_hex_var}
print -rC1 -- ${(q+)${(Q)@}}
echo "\n-----------------------------\n"
for element ("$@") print -rn -- $element | od -vAx -tx1 -tc
}
hex var
print var | hex
> Anyway I'm determined to stop guessing and find some way of seeing
> exactly what makes some hunk of data split this way or that way. If
> it's NULs, then I want to see the NULs.
More on this later.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author