Bug 42282 - read command does not accept input from pipe.
read command does not accept input from pipe.
Status: CLOSED DUPLICATE of bug 19747
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-05-25 11:02 EDT by Lisa Rojas
Modified: 2007-04-18 12:33 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-05-25 11:02:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lisa Rojas 2001-05-25 11:02:54 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.7 [en]C-CCK-MCD {LabCorp}  (Win95; U)

Description of problem:
Simplified version
*********************************
echo 1 | read a
echo $a

*******************
The variable a does not come out as the expected 1.  Instead, the variable is unset. 
Note this problem also appears in pdksh.   

How reproducible:
Always

Steps to Reproduce:
1. echo 1 |read a
2.echo a
3.
	

Actual Results:  variable is not set.

Expected Results:  Variable should be set to 1 in the example.  

Additional info:
Comment 1 Bernhard Rosenkraenzer 2001-05-28 03:02:00 EDT
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.


*** This bug has been marked as a duplicate of 19747 ***

Note You need to log in before you can comment on or make changes to this bug.