Subject: Re: strange IFS behaviour in /bin/sh ?
To: None <current-users@netbsd.org>
From: Geoff Wing <gcw@pobox.com>
List: current-users
Date: 05/10/2004 23:30:04
Eric Haszlakiewicz <erh@nimenees.com> output:
:On Mon, May 10, 2004 at 07:40:49AM +0000, Geoff Wing wrote:
:> Doesn't seem so to me but maybe I've missed the point.
:	you did.  The point is it's supposed to split the value based on the
:IFS setting.  A workaround is:

Which point did I miss?

:# IFS=/
:# set `echo /dev/wd1e`

IFS field-splitting is performed on echo argument.  set is
passed two arguments.

:# echo $1
:dev
:	However, without the command evaluation it fails the way Darren describes,
:for any IFS.  e.g.:
:
:# IFS=:
:# set 'root:foo:bar:bax'

You've enclosed this in single quotes.  It's one argument for set.

:# echo $1
:root foo bar bax
:
:	Furthermore, setting a variable with that value first, and using it as the
:arg to set works fine.
:# var='root:foo:bar:bax'
:# set $var
:# echo $1
:root

IFS field-splitting is performed on parameter substitution.  This occurs before
the echo line.

:I have no idea whether it's supposed to work like that or not.  It certainly
:seems non-intuitive.

Still seems fine to me.

Regards,
-- 
Geoff Wing : <gcw@pobox.com>
Rxvt Stuff : <gcw@rxvt.org>
Zsh Stuff  : <gcw@zsh.org>