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

Re: more splitting



On Fri, Apr 17, 2026 at 10:11 AM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
>> Zsh's slightly-older sister Bash has a built-in function called readarray that splits input on a delimiter and puts the resulting strings into an array; it is unusual in that it does keep the delimiter around by default at the end of each element.
>
> That's about exactly what I was  suggesting in my private msg. just now.  Splitting information could be preserved very easily.  But altering the data ... wrong on principle.

You're still misunderstanding.  readarray still takes a byte stream as
input, so in most of your examples the separator information is
ALREADY "lost" before readarray would even see it.  What readarray
does is build a NEW array based on the bytes in the stream.  There's
no inherent preservation of data from a source array.




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