Ah - I see. In the original ksh, the read is done within the same process - no subprocess is created. Thus the construct I used worked just fine there. Just another difference between pdksh and real ksh. Thanks! -----Original Message----- From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-bounces@xxxxxxxxxx] On Behalf Of Dave Ihnat Sent: Thursday, November 03, 2005 11:47 AM To: General Red Hat Linux discussion list Subject: Re: Attempting to understand behavior of /bin/ksh's read command On Thu, Nov 03, 2005 at 11:07:59AM -0500, Virden, Larry W. wrote: > $ echo aa bb cc dd | read a b c d > > $ echo $a > > /bin/ksh: a: parameter not set Nothing's wrong; it's doing just what you told it to do. You just told it to do the wrong thing. You told it to spawn a subshell--note the pipe--which certainly read the output from the echo command, set its own variables a, b, c, and d--and then destroyed them when it exited. You can't set variables in a parent from a child. If you type: read a b c d This is a test echo $a $b $c $d you'll see it's parsed them properly; everything is in the same shell. So how do you redirect input ? There are various ways. exec 0<filename echo aa bb cc dd | ( read a b c d echo $a $b $c $d ) and so on. Cheers, -- Dave Ihnat ignatz@xxxxxxxxxx -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list