Bug 19747
| Summary: | Bash's builtin function "read" does not set the variable | ||
|---|---|---|---|
| Product: | [Retired] Red Hat Linux | Reporter: | danmcnaul |
| Component: | bash | Assignee: | Bernhard Rosenkraenzer <bero> |
| Status: | CLOSED NOTABUG | QA Contact: | David Lawrence <dkl> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.0 | CC: | danmcnaul, twaugh |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | i686 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2000-10-26 12:25:03 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: | |||
|
Description
danmcnaul
2000-10-25 13:04:40 UTC
What about: grep TOPMS_UNIT= serv.conf | sed 's/TOPMS_UNIT=//' | read UNIT ? Or is that what you were doing? Oh Jesus, Yes, that is what I meant. I went back and retested to make sure I didn't pull a Homer. In my examples where I say "BASE_UNIT=" I meant to say "TOPMS_UNIT". Sorry McNaul If you're going to mark the MR as "Resolved, notabug" shouldn't you at least explain yourself. I have scripts that used to work in previous Redhat releases that are now failing because of this. Why is this NOTABUG? McNaul I misunderstood and thought that your original script was in error.
But this is what the Single UNIX spec says:
"Some systems have implemented the last stage of a pipeline in the current
environment so that commands such as:
command | read foo
set variable foo in the current environment. This extension is allowed, but not
required; therefore, a shell programmer should consider a pipeline to be in a
subshell environment, but not depend on it."
And 'man bash' (line 277) says:
"Each command in a pipeline is executed as a separate process (i.e., in a
subshell)."
So it isn't really a bug in bash, as far as I can see.
It isnt a bash bug do foo|bar| (read A; echo $A) I agree that this MR should be closed as NOTABUG. The example given above works to set a variable in the current shell to the value expected. The coding is different, but it works. Dan McNaul *** Bug 20564 has been marked as a duplicate of this bug. *** *** Bug 21902 has been marked as a duplicate of this bug. *** *** Bug 42282 has been marked as a duplicate of this bug. *** *** Bug 59222 has been marked as a duplicate of this bug. *** |