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

Apparent inconsistency in f/z expansion flags behavior



Hello there!

I'm seeing an unexpected (to me) difference in the behavior of these flags.

Say you do something like:

words=(${(z)$(</proc/meminfo)})

Which set words with the array of all the words in the file and that's
great.

Then I try the f flag in place of z, expecting to get an array with the
file's lines:

lines=(${(f)$(</proc/meminfo)})

But then I get an array with just one string containing all the lines
concatenated (no NLs).

So... Is this expected? What I need to do to get the array of lines?

Note that if you split the last assignment in 2 steps, it works as expected:

lines=$(</proc/meminfo)
lines=(${(f)lines})

Which is ok, but of course anybody would want to do it in one step, right?

Cheers!


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