zsh-users
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: TJ Luoma <luomat@gmail.com>
Cc: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: why isn't IFS=$'\n' doing what I expect it to do here?
Date: Sun, 24 Mar 2013 00:46:41 -0400	[thread overview]
Message-ID: <20130324044640.GA73632@redoubt.spodhuis.org> (raw)
In-Reply-To: <CADjGqHtU3bNfYMdUCNGBpJsB-6gsq2boT6X3Qevwr8VF_U5PHg@mail.gmail.com>

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


  reply	other threads:[~2013-03-24  4:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-24  2:01 TJ Luoma
2013-03-24  3:09 ` Phil Pennock
2013-03-24  3:27   ` TJ Luoma
2013-03-24  4:46     ` Phil Pennock [this message]
2013-03-24  3:47 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130324044640.GA73632@redoubt.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=luomat@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).