[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [50 character or so descriptive subject here (for reference)]
From: |
Chet Ramey |
Subject: |
Re: [50 character or so descriptive subject here (for reference)] |
Date: |
Wed, 16 May 2001 10:46:50 -0400 |
> Bash Version: 2.04
> Patch Level: 0
> Release Status: release
>
> Description:
> very strange argument splitting example.
> Saw this in man-1.5i configuration.
> This works correctly on:
> bash1
> ksh (on solaris 2.7) (not sure which one)
> sh (on on solaris 2.7)
These all have bugs.
> This doesn't work with:
> bash2 (tried 2.04 and 2.05)
> pdksh
These are correct.
> Repeat-By:
> IFS=":$IFS"
> FOO=/fee:/fi:/fo:/fum
> for i in /bin:/usr/bin/:/usr/ucb:$FOO
Word splitting is performed only on the results of expansion. When
the `for' splits its arguments, it results in four words:
/bin:/usr/bin/:/usr/ucb:/fee
/fi
/fo
/fum
The first argument is re-split when the `echo $i' is performed. You
can get a clearer picture of what's going on if you double-quote the
argument to echo:
/bin:/usr/bin/:/usr/ucb:/fee
/fi
/fo
/fum
--
``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/