Red Hat Bugzilla – Bug 79864
echo error using pipe command
Last modified: 2007-04-18 12:49:06 EDT
Description of problem:
If you create a shell script with a read command and echo eg just:-
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):
Consistently fails !
Steps to Reproduce:
1. run shell script as stated above
doesn't echo input
should echo input !
doesn't seem to be related to shell chosen (ie fails in csh and bash)
or dependant on an enviroment settings !
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)