Possible bug in SunOS Release 4 Bourne Shell?
Keith Waclena
keith%tira at gargoyle.uchicago.edu
Sat Aug 5 08:21:42 AEST 1989
Hardware: Sun 4/110, Sun 3/50
OS: SunOS 4.0, SunOS 4.0.1
The following shell script gives different results when invoked with
standard input redirected from a file, compared to when the same file is
piped into it via cat.
$ cat testread.sh
#!/bin/sh
read FIRSTLINE
read SECONDLINE
(echo "$FIRSTLINE"; echo "$SECONDLINE"; cat)
$ cat FOO
AAA
BBB
CCC
$ cat FOO | /bin/sh testread.sh
AAA
BBB
CCC
$ /bin/sh testread.sh <FOO
AAA
BBB
AAA
BBB
CCC
$
(This problem showed up in a realistic context; testread.sh is the
smallest script I can write that illustrates the problem.)
The script works (i.e., produces the same output regardless of whether the
input comes from redirection or from a pipe) under the following standard
Bourne shells: on a Sun 3/50 running SunOS 3.4, on an Elxsi running their
version of Unix, and on an AT&T 3B15 running System V r2.
Is this a known bug? Does it exist in the latest version of SunOS?
(We're upgrading soon.)
Thanks for the info,
Keith
--
Keith WACLENA keith at curry.uchicago.edu
GLS / TIRA / U of Chicago keith%curry at uchimvs1.bitnet
1100 E.57th.St Chi IL 60637 USA ...!uunet!curry.uchicago.edu!keith
More information about the Comp.sys.sun
mailing list