Bug 79864 - echo error using pipe command
echo error using pipe command
Product: Red Hat Linux
Classification: Retired
Component: syslinux (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Matt Wilson
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2002-12-17 11:48 EST by Pat Norris
Modified: 2007-04-18 12:49 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-10-15 14:27:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Pat Norris 2002-12-17 11:48:46 EST
Description of problem:
If you create a shell script with a read command and echo eg just:-
read ans1
echo $ans1

then run whatever name you've called it eg try1 and do :
try1 | less

the standard input on the read statement remains hidden (although it works!)

Version-Release number of selected component (if applicable):

How reproducible:
Consistently fails !

Steps to Reproduce:
1. run shell script as stated above
Actual results:

doesn't echo input

Expected results:

should echo input !

Additional info:
doesn't seem to be related to shell chosen (ie fails in csh and bash)
or dependant on an enviroment settings !
Comment 1 Miloslav Trmac 2002-12-18 11:46:19 EST
That is right. less certainly doesn't want to show you your keystrokes,
so it disables echo. The terminal state is global, not per-process,
so echo is disabled for the shell script too.
To do what you probably want,
replace (the equivalent of) (read x; echo $x)|less
with read x; (echo $x |less)

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