Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Aug 1996 10:30:01 -0700 (PDT)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        freebsd-bugs
Subject:   Re: bin/1454: /bin/sh bug handling <<[n] FD processing
Message-ID:  <199608011730.KAA26705@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/1454; it has been noted by GNATS.

From: J Wunsch <j@uriah.heep.sax.de>
To: pst@Shockwave.COM
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/1454: /bin/sh bug handling <<[n] FD processing
Date: Thu, 1 Aug 1996 18:51:33 +0200 (MET DST)

 As Paul Traina wrote:
 
 > The manual page for sh states that invoking a program with:
 > 
 > 	program 2<<EOT
 > 	some stuff
 > 	EOT
 > 
 > should send the text down file descriptor #2 on the program.  It does not.
 
 $ cat > foo.c
 #include <unistd.h>
 
 int
 main(void)
 {
   char b[512];
   int s;
   while((s = read(2, b, 512)) > 0)
     write(1, b, s);
   return 0;
 }
 ^D
 $ cc foo.c
 $ ./a.out 2<<EOF
 > hello
 > world
 > EOF
 hello
 world
 $
 
 So hmmmm?
 
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
 Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199608011730.KAA26705>