* bug in read command in sh under OSF1 V3.0
@ 1997-03-21 5:00 Dan Lipofsky
1997-03-27 5:00 ` Bob Vickers
0 siblings, 1 reply; 4+ messages in thread
From: Dan Lipofsky @ 1997-03-21 5:00 UTC (permalink / raw)
I have discovered a bug (I dont think anyone would call it a feature)
in the functioning of the "read" command in sh under OSF1 V3.0
I have compared it to Linux 2.0, SunOS (4.1.3, 4.1.4, and 5.5),
AIX 4.1, and HP-UX A.09.01. This only occurs under OSF1 V3.0.
If you read in a line which contains '\\t' (or similar things)
it reads in as '\t', except under OSF1, where it reads in as '\\t'.
If you read in a line which contains '\t' [the preceding character isnt a \]
it reads in as 't' under all systems.
This basically means that there is no way to read in a line so
the result will contain '\t', since every attempt will yield
either `\\t` or `t`.
Does anyone know or a fix or a work-around?
Does anyone know where this bug should be reported?
Here is a script which demonstrates the problem:
$ cat /home/danlip/tmp/foo
\tfoobar\n
$ cat /home/danlip/tmp/bar
\\tfoobar\\n
$ cat ./test.sh
#! /bin/sh
test1='\\tfoobar\\n'
test2='\tfoobar\n'
test3='tfoobarn'
read foo < /home/danlip/tmp/foo
if [ $foo = $test1 ]; then
echo "read matches test1"
elif [ $foo = $test2 ]; then
echo "read matches test2"
elif [ $foo = $test3 ]; then
echo "read matches test3"
else
echo "read - NO MATCH"
fi
read bar < /home/danlip/tmp/bar
if [ $bar = $test1 ]; then
echo "read matches test1"
elif [ $bar = $test2 ]; then
echo "read matches test2"
elif [ $bar = $test3 ]; then
echo "read matches test3"
else
echo "read - NO MATCH"
fi
$ ./test.sh
read matches test3
read matches test1
The results above are from OSF1.
On all other operating systems I get:
$ ./test.sh
read matches test3
read matches test2
Thanks for any help,
Dan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bug in read command in sh under OSF1 V3.0
1997-03-21 5:00 bug in read command in sh under OSF1 V3.0 Dan Lipofsky
@ 1997-03-27 5:00 ` Bob Vickers
1997-03-28 5:00 ` David Boyce
0 siblings, 1 reply; 4+ messages in thread
From: Bob Vickers @ 1997-03-27 5:00 UTC (permalink / raw)
To: Dan Lipofsky
Dan Lipofsky wrote:
>
> I have discovered a bug (I dont think anyone would call it a feature)
> in the functioning of the "read" command in sh under OSF1 V3.0
>
> I have compared it to Linux 2.0, SunOS (4.1.3, 4.1.4, and 5.5),
> AIX 4.1, and HP-UX A.09.01. This only occurs under OSF1 V3.0.
>
>
Dan,
Change the first line of the OSF1 version to #!/bin/ksh . Korn shell
will give you much more consistent behaviour across different systems
than Bourne shell.
Bob
--
======================================================================
Bob Vickers R.Vickers@rhbnc.ac.uk
Dept of Computer Science, Royal Holloway College, University of London
WWW: http://www.dcs.rhbnc.ac.uk/%7Ebobv/
Phone: +44 1784 443691
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bug in read command in sh under OSF1 V3.0
1997-03-28 5:00 ` David Boyce
@ 1997-03-28 5:00 ` Mike Iglesias
0 siblings, 0 replies; 4+ messages in thread
From: Mike Iglesias @ 1997-03-28 5:00 UTC (permalink / raw)
In article <333BD4B9.3C8B@world.std.com>,
David Boyce <dsb@world.std.com> wrote:
>Speaking only from distant memory: I believe Digital has an extremely old
>version of the Bourne shell in /usr/bin/sh for some reason of backward
>compatibility. The classic System V Bourne shell, which most vendors ship
>as /usr/bin/sh, is shipped by them as /usr/bin/sh5. Yes, this is frustrating.
Your memory is off - Ultrix had the old sh and sh5.
--
Mike Iglesias Internet: iglesias@draco.acs.uci.edu
University of California, Irvine phone: (714) 824-6926
Office of Academic Computing FAX: (714) 824-2069
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: bug in read command in sh under OSF1 V3.0
1997-03-27 5:00 ` Bob Vickers
@ 1997-03-28 5:00 ` David Boyce
1997-03-28 5:00 ` Mike Iglesias
0 siblings, 1 reply; 4+ messages in thread
From: David Boyce @ 1997-03-28 5:00 UTC (permalink / raw)
<HTML><BODY>
Bob Vickers wrote:
<BLOCKQUOTE TYPE=CITE>Dan Lipofsky wrote:
<BR><I>></I>
<BR><I>> I have discovered a bug (I dont think anyone would call it a feature)</I>
<BR><I>> in the functioning of the "read" command in sh under
OSF1 V3.0</I>
<BR><I>></I>
<BR><I>> I have compared it to Linux 2.0, SunOS (4.1.3, 4.1.4, and 5.5),</I>
<BR><I>> AIX 4.1, and HP-UX A.09.01. This only occurs under OSF1 V3.0.</I>
<BR><I>></I>
<BR><I>></I>
<BR>
<BR>Dan,
<BR>
<BR>Change the first line of the OSF1 version to #!/bin/ksh . Korn shell
<BR>will give you much more consistent behaviour across different systems
<BR>than Bourne shell.
</BLOCKQUOTE>
Speaking only from distant memory: I believe Digital has an extremely old
version of the Bourne shell in /usr/bin/sh for some reason of backward
compatibility. The classic System V Bourne shell, which most vendors ship
as /usr/bin/sh, is shipped by them as /usr/bin/sh5. Yes, this is frustrating.
<BR>
<BR>David
</BODY>
</HTML>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1997-03-28 5:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-03-21 5:00 bug in read command in sh under OSF1 V3.0 Dan Lipofsky
1997-03-27 5:00 ` Bob Vickers
1997-03-28 5:00 ` David Boyce
1997-03-28 5:00 ` Mike Iglesias
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox