Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Apparent inconsistency in f/z expansion flags behavior
- X-seq: zsh-users 22232
- From: Pablo Lalloni <plalloni@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Apparent inconsistency in f/z expansion flags behavior
- Date: Sun, 18 Dec 2016 20:02:29 -0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=TqI7fVbIR0nohFnadH/VRQokM8r0hbL749EUL+SMpO8=; b=GKQy/IkBY6ZR0iNsBXJ5EtjKvMEOGG9bKjGZIMOgpIGFEPe0cmLOJ91Ok8JlpHNAC0 5Z0KmtvvvrmzlQBdts+9pFFWa1ZOLI9o/rFoTtk3on1XhKFy1q6fAmXO9ib7MRkPuc9J ek2fNYQ1uucMIzxGGWH2URA+NlQI67ZVIcOglhcxp1jXLjzYNf4YmNyH3GyzcXu8E6hM LQM41XnfX2I78fQ9qTzFTjznoXbVZ1E1Lbb2vHq85S8tb9n6KTKXUDvk/88LOrTjbRMH Xj5cFvPt8l0ZS6LE40xyYGdd+WP2vrTdpEai6nzAVNwQ6in8l0cl85M8ony+V1rObUvm fU2Q==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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