Bug 20564
| Summary: | read builtin corrupts parameter assignment in loop | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | b.g.m.kusters |
| Component: | bash | Assignee: | Bernhard Rosenkraenzer <bero> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.2 | CC: | dr |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i386 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2000-11-10 09:42:20 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
TESTED with RedHat 6.2 not 4.2 This is another effect of the modifications to make bash compliant to the Single UNIX Specification (See bug #19747). *** This bug has been marked as a duplicate of 19747 *** |
Tested in bash and bash2 Parameter assignment in loop is not exported out of the loop if read is used see script. Same error occures if read is used in combinatie with pipe eg. tail -n 1 x2 | read p1 p2. No assignment to parameters read take place. #!/bin/bash2 echo "1" > x2 echo "2" >> x2 echo "Error parameter not exported" d="" cat x2|while read p1 do echo "d1 = $d" d="${d}${p1}" echo "d2 = $d" done echo "d3 = $d" echo "" echo "No Error parameter is exported" d="" set $(cat x2) while [ $# -ne 0 ] do p1=$1 shift 1 echo "d1 = $d" d="${d}${p1}" echo "d2 = $d" done echo "d3 = $d"