Subject: Re: strange IFS behaviour in /bin/sh ?
To: Geoff Wing <mason@primenet.com.au>
From: Eric Haszlakiewicz <erh@nimenees.com>
List: current-users
Date: 05/10/2004 07:51:52
> Darren Reed <avalon@caligula.anu.edu.au> typed:
> : ...is "/" a magical character for IFS ?
> : Or is there a bug here ?
bug, I think, maybe.
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:
# IFS=/
# set `echo /dev/wd1e`
# 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'
# 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
I have no idea whether it's supposed to work like that or not. It certainly
seems non-intuitive.
eric