From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9999 invoked by alias); 24 Mar 2013 03:48:20 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17733 Received: (qmail 2219 invoked from network); 24 Mar 2013 03:48:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130323204754.ZM26671@torch.brasslantern.com> Date: Sat, 23 Mar 2013 20:47:54 -0700 In-reply-to: Comments: In reply to TJ Luoma "why isn't IFS=$'\n' doing what I expect it to do here?" (Mar 23, 10:01pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh-Users List Subject: Re: why isn't IFS=$'\n' doing what I expect it to do here? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Mar 23, 10:01pm, TJ Luoma wrote: } } I don't understand why IFS=$'\n' doesn't seem to be doing what I'd expect Um, because you're expecting the wrong thing? (I'm pretty sure this was answered on the list not that long ago, but danged if I can find the message.) IFS does not affect the shell's parsing of its own script language. If it did, all sorts of scripts would fail any time IFS were exported into the environment. (Below here updated slightly because Phil's answer came in while I was typing.) As Phil mentioned, what it DOES affect is: - Splitting or joining of words in shell expansions/substitutions - The interpretation of input strings e.g. via the "read" builtin or "vared" So as an alternative to Phil's parameter expansion trick, you can do this: IFS=$'\n' read -d '' -A APPS <<-\APPS Alfred 2 Bartender ddnsa Fantastical Flycut HazelHelper MagiCal MenuBarFilter Mountain Should I Sleep SizeUp Trickster APPS (Note this returns 1 because read encounters end of file before it finds the empty separator. Since it won't ever find the empty separator, it may be that this should be made a special case that returns zero.)