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

Re: triviality regarding $# counts





On 2024-04-14 06:35, Roman Perepelitsa wrote:
On Sun, Apr 14, 2024 at 3:25 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
# If you want a COPY ... yes, a Xerox copy:

% fff=( "${(@f)ddd}" )

# That's a COPY ... and don't even think about a simpler way, we are on this earth to suffer.
That won't make a copy if any of the ddd elements have a newline in
them. Recall what (f) does.
But:

% ggg=( 'abc\n' '\n' 'def\n' '\n' 'ghi\n' )

% hhh=( "${(@f)ggg}" )

% typeset -p hhh; typeset -p ggg
typeset -a hhh=( 'abc\n' '\n' 'def\n' '\n' 'ghi\n' )
typeset -a ggg=( 'abc\n' '\n' 'def\n' '\n' 'ghi\n' )

... nuts yesterday I thought I had it figured out that the newlines would be removed but look at the above.







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