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
Perfect! If the *name* is passed, then it doesn't matter if it's a
data stream. I trust a name is always a string, so front door or
back door ... all the same. I hope my comments are correct:On Tue, Apr 14, 2026 at 8:26 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
print -rC1 -- ${(q+)${(Q)@}}
Sorry, there's an extra (Q) in there, should be just
print -rC1 -- ${(q+)@}
Too much copy-pasting.
That was one of my questions :-)
Already fixed above.