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

Re: why isn't IFS=$'\n' doing what I expect it to do here?



On 2013-03-23 at 23:27 -0400, TJ Luoma wrote:
> > Similarly, you can use:
> >   APPS=(${=${:-'
> > for the first line, to actually split on $IFS, in which case changing
> > IFS does affect parsing here.
> >
> > -Phil
> >
> 
> If I do that then I can no longer use "$f[5]" to refer to the 5th _line_ …
> I end up getting a single character instead of a line.

Then something is strange in your environment.

The (f) forces splitting on lines, resulting in an array, and is
assigned inside APPS=( ... ).

Similarly for the = (which uses $IFS to split).

I've just confirmed with "zsh -f" that this works just fine with default
options.  I suspect that you missed the outer ${(f) ... } wrapper.

-Phil



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