Re: more splitting
Bart Schaefer <[email protected]> Fri, 17 Apr 2026 10:30:47 -0700
| Newsgroups | gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CAH+w=7ZE9rWRXO=LMOu=A9o-o5P6yLMDxC=7JmDebV6XEEc+2w@mail.gmail.com> |
On Fri, Apr 17, 2026 at 10:11 AM Ray Andrews <[email protected]> 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.