Re: ksh - no "read" from pipe, but not common "subshell" issue

From: Chris F.A. Johnson (cfajohnson_at_gmail.com)
Date: 11/17/05


Date: Thu, 17 Nov 2005 14:44:34 -0500

On 2005-11-17, Lars Kellogg-Stedman wrote:
>> No, it's not, unless OSX does something differently from other
>> unices. Try it and see.
>
> I don't post untested code.

   On any other system, this is what happens:

$ echo "Hello World." | { read; echo "$REPLY"; }
Hello World.

   And, since the OP is using ksh, the same result should obtain
   without the braces:

$ echo "Hello World." | read; echo "$REPLY"
Hello World.

   If this is not what happens, there is something wrong with either
   the OS or the shell.

   To dan.rickhoff: What happens if you use bash instead of ksh?

-- 
   Chris F.A. Johnson, author   |    <http://cfaj.freeshell.org>
   Shell Scripting Recipes:     |  My code in this post, if any,
   A Problem-Solution Approach  |          is released under the
   2005, Apress                 |     GNU General Public Licence


Relevant Pages