Red Hat Bugzilla – Bug 84000
for-statement expansion with IFS changed broken
Last modified: 2007-04-18 12:50:59 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20021120
Description of problem:
The expansion of the list of a for statement does not work the same with IFS
changed as it does with the default IFS. If the list consists of a variable
containing a list of items separated by IFS, and this variable is followed by
IFS and then another item, the last item in the variable's list is concatenated
with the following item. This does not happen when IFS is blank space.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.Run the script provided below.
Actual Results: foo
Expected Results: foo
Here's the script that shows it
TO_DO_LIST="foo bar baz"
for item in $TO_DO_LIST next
for item in $TO_DO_LIST:next
Upstream maintainer clarified the issue to me in private mail: only the result
of the variable expansion is eligible for field splitting here. Use 'echo
"$item"' to see more clearly what's going on; you get this output:
This is how POSIX specifies field splitting to operate.