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

Re: triviality regarding $# counts



On Fri, Apr 12, 2024 at 6:13 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> I've got a whole bunch of that figured out today.  What I thought were arrays were scalars that just happened to print nicely on separate lines where wanted but not due to '\n''s.  And what I thought line splitting -- (f) -- did was enter '\n's into the body of the variable -- a guy might be forgiven for thinking that -- but no it's dollar signs.

You're definitely confusing yourself again there somehow.  (f) does
not "enter" anything into the "body" of a variable -- it splits a
string into an array, converting newlines into the breaks between
array elements.  I have no idea where you think dollar signs are
coming from ... unless possibly because "typeset -p" will output array
elements using $'...' quoting if there are certain non-printable
characters in the element?

>  One thing: it sure is hard to hang on to blank lines.  I wish there was some option to default to preserving them.

Again this is not making much sense.  There are only two cases:
Strings with newline characters in them, and array elements where a
blank line might become an empty element if you got there by splitting
a string.  Empty elements generally get removed from argument lists if
you reference the array without proper quoting, especially if you're
forcing an additional layer of interpretation by using "eval", but
they won't be removed from the array itself.




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