bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "IFS=: for foo in $FOO:bar:baz; do" doesn't work properly


From: Chet Ramey
Subject: Re: "IFS=: for foo in $FOO:bar:baz; do" doesn't work properly
Date: Thu, 30 Aug 2001 09:38:21 -0400

> Machine Type: i386-redhat-linux-gnu
> 
> Bash Version: 2.05
> Patch Level: 8
> Release Status: release
> 
> Description:
>       Run this script in bash 2.05:
> 
>         #!/bin/sh
> 
>         FOO="foo:bar:baz"
>         IFS=:
> 
>         for ac_dir in $FOO:screlt:freeble; do
>             echo $ac_dir
>         done
> 
>         echo ''
> 
>         ac_dummy=$FOO:screlt:freeble
>         for ac_dir in $ac_dummy; do
>             echo $ac_dir
>         done
> 
>       You'll see this output:
> 
>         foo
>         bar
>         baz screlt freeble
> 
>         foo
>         bar
>         baz
>         screlt
>         freeble

And that is correct.

>       That's wrong.  The first and second blocks of output should be
>       identical.

No, they should not.  Bash-1.14 gets it wrong.

Word splitting is performed only on the results of expansion, and is
not performed in assignment statements.

Chet


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    chet@po.CWRU.Edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]