From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10574 invoked by alias); 24 Mar 2013 03:27:31 -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: 17731 Received: (qmail 23266 invoked from network); 24 Mar 2013 03:27:29 -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=-3.3 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at spodhuis.org does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201210; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=dT+qP7tz82289DzzesVM9cuSvTAOxSJzrk0ARPb/iD4=; b=vc1IxBKgUMonJh+DbQDvkSGK7iNjztTssPyaJtpBrI6+JAiZ5TtOBN8o5JVRqY52veVObj1xJx8jKBMyHCo/8vjMrsbg8NBiMSQoKOkoHtqhYseERunlRxKuR2/7HsSSbhO0p75fTG9tDfibRWY9fachLtw47LFVpUstd1D3BOc=; Date: Sat, 23 Mar 2013 23:09:38 -0400 From: Phil Pennock To: TJ Luoma Cc: Zsh-Users List Subject: Re: why isn't IFS=$'\n' doing what I expect it to do here? Message-ID: <20130324030938.GA70966@redoubt.spodhuis.org> Mail-Followup-To: TJ Luoma , Zsh-Users List References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On 2013-03-23 at 22:01 -0400, TJ Luoma wrote: > I don't understand why IFS=$'\n' doesn't seem to be doing what I'd expect here: > > $ cat test-arrays.zsh > IFS=$'\n' APPS=( This isn't command or parameter expansion, or reading data with the read builtin. IFS would apply if you put the data into a variable and then caused parameter expansion with splitting on IFS, eg by using the = parameter expansion modifier, or setting sh_word_split. This is input parsing, for assignment to a variable, not parameter expansion. Mind, that doesn't mean that thinking through this isn't giving me a headache. ----------------------------8< cut here >8------------------------------ % APPS=(${(f)${:-' Alfred 2 Bartender ddnsa Fantastical Flycut HazelHelper MagiCal MenuBarFilter Mountain Should I Sleep SizeUp Trickster ' }} ) ----------------------------8< cut here >8------------------------------ Is that closer? Note though that leading (and trailing) whitespace becomes significant. Similarly, you can use: APPS=(${=${:-' for the first line, to actually split on $IFS, in which case changing IFS does affect parsing here. -Phil