From owner-freebsd-questions Thu Jan 20 9:33:47 2000 Delivered-To: freebsd-questions@freebsd.org Received: from cc942873-a.ewndsr1.nj.home.com (cc942873-a.ewndsr1.nj.home.com [24.2.89.207]) by hub.freebsd.org (Postfix) with ESMTP id 56DA015105 for ; Thu, 20 Jan 2000 09:33:41 -0800 (PST) (envelope-from cjc@cc942873-a.ewndsr1.nj.home.com) Received: (from cjc@localhost) by cc942873-a.ewndsr1.nj.home.com (8.9.3/8.9.3) id MAA72926 for freebsd-questions@FreeBSD.org; Thu, 20 Jan 2000 12:38:27 -0500 (EST) (envelope-from cjc) Date: Thu, 20 Jan 2000 12:38:27 -0500 From: "Crist J. Clark" To: freebsd-questions@FreeBSD.org Subject: sh(1) Messing with My Mind Message-ID: <20000120123827.A72914@cc942873-a.ewndsr1.nj.home.com> Reply-To: cjclark@home.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I think my mind is broken or something. This is really confusing me. I must be missing or forgetting something obvious. I was writing a sh-script that ran some stuff through awk and I wanted to drop the results in some shell variables, so I piped the awk output to a read command. But it would not work. The sh-builtin "read" seems to have muddled my thoughts this morning. Why does this happen: $ echo 3 | read NUM $ echo $NUM $ read NUM 3 $ echo $NUM 3 $ echo "TEST" | read STR $ echo $STR $ echo "TEST" > afile.txt $ read STR < afile.txt $ echo $STR TEST $ Where the second read shows my keyboard input working, and the third shows a successful redirect to read from a file. Why does it look like read won't read from a piped stdin? I could swear I used to do this all of the time. -- Crist J. Clark cjclark@home.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message