Description of problem: when executing a while statement and assigning a value to a variable, the value does not exist after the while loop is completed: The following is the script cd /usr/share/terminfo/w x2="" export x2 ls wy50*|while read x1 do if [ "X"$x2 = "X" ] then : else x2=$x2"," fi x2=$x2$x1 done echo $x2 Version-Release number of selected component (if applicable): 2.05b.0 How reproducible: See above command segment Steps to Reproduce: 1. 2. 3. Actual results: x2="" Expected results: wy50,wy50-mc,wy50-vb,wy50-w,wy50-wvb Additional info: for x1 in `ls wy50*` instead of ls wy50*|while read x1 does work
in expected results the variable x2 should be set to the listed data
Please see the bash FAQ, question E4: /usr/share/doc/bash-*/FAQ.