Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: more splitting





On 2026-04-15 15:21, dana wrote:
... again there is no standard for structured pipe
data in the unix world, it's all just bytes, and each command has to
decide for itself what bytes to put in and how to interpret the bytes
that come out
Right, as Mark was saying.  I get it.
they are not retained. this is a quirk of the way splitting flags like
(s) and (f) work. by default they want to treat the parameter to be
split as a scalar. so just like in your earlier example with the
var2=$var assignment, the shell has to convert var into a single element
for it. to do that it joins the elements using the first character of
IFS, which is a space by default. it's equivalent to this:
Yeah, I think that's clearly necessary. Itcantjustpilethecharsoneontopoftheother, there has to be a word separator, so spaces must be added where needed.
... so typeset output very close to original variable creation
keystrokes.
to be clear, typeset is re-quoting everything from scratch because,
again, the shell doesn't store how you quoted things originally. the
quoting style it uses is basically the same as the (q+) style, which is
designed to be minimal (i.e. easier to read). so it will often happen to
match what the way you wrote it, but not necessarily
But my conclusion is that a typeset -p output will always generate an identical array, no?


dana






Messages sorted by: Reverse Date, Date, Thread, Author