Re: more splitting

Bart Schaefer <[email protected]> Wed, 15 Apr 2026 09:07:31 -0700
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <CAH+w=7baxRZ07mZphAbsCeF5UpRpAqYXN7yEW9MxXEcHBfnH+w@mail.gmail.com>
On Wed, Apr 15, 2026 at 8:21 AM Ray Andrews <[email protected]> wrote:
>
> I hope my comments are correct:
>
>        read -d '' -r _hex_var   # -d:terminate on nul, -r:'raw'--all literal.

Correct.  The effect here is to read the entire input as one string.

>     # (q+):quote the quotes ... sorta, -C1: columns split on spaces.

Not exactly.  No splitting is done by "print".

When the name passed in refers to an array, ${(P)_hex_var} will also
be an array.  So:
  # (q+):quote the string, or quote each element if the value is an array
  # -C1: print each string or array element in a single column

Even more accurately:
 # (q+): apply quotes using the simpler of '...' or $'...' as needed
 # -C1: make one column out of all the arguments to "print".

You can also do -C2, etc.