bug of sh ?
I don't know I've found a bug of sh or it is exactly the case it
should be:
The problme is mainly that, for the following script,
step1 p1 `lengthy shell invoking` p... >> output
step2 p1 `lengthy shell invoking` p... >> output
...
stepN p1 `lengthy shell invoking` p... >> output
the stepN will overwrite the output of stepN-1. And here is the detail:
The output of my script "myscript" is:
$ myscript
printf "<h2><a href=reference/standard/0764580523/ewtoc.html>`perl -S title_get reference/standard/0764580523/ewtoc.html`</a></h2><br>\n"
printf "<h2><a href=reference/standard/1576101762/ewtoc.html>`perl -S title_get reference/standard/1576101762/ewtoc.html`</a></h2><br>\n"
printf "<h2><a href=reference/standard/1576101215/ewtoc.html>`perl -S title_get reference/standard/1576101215/ewtoc.html`</a></h2><br>\n"
The output of '>' is right:
$ myscript | sh > output
$ cat !$
<h2><a href=reference/standard/0764580523/ewtoc.html>JavaBeans: Table of Contents</a></h2><br>
<h2><a href=reference/standard/1576101762/ewtoc.html>Visual Developer SQL Database Programming with Java - Table of Contents</a></h2><br>
<h2><a href=reference/standard/1576101215/ewtoc.html>Web Developer's Guide to Java Beans - Table of Contents</a></h2><br>
But the output of ">>" is wrong:
$ rm output; myscript | sh -x >> output
++ perl -S title_get reference/standard/0764580523/ewtoc.html
+ printf '<h2><a href=reference/standard/0764580523/ewtoc.html>JavaBeans: Table of Contents</a></h2><br>\n'
++ perl -S title_get reference/standard/1576101762/ewtoc.html
+ printf '<h2><a href=reference/standard/1576101762/ewtoc.html>Visual Developer SQL Database Programming with Java - Table of Contents</a></h2><br>\n'
++ perl -S title_get reference/standard/1576101215/ewtoc.html
+ printf '<h2><a href=reference/standard/1576101215/ewtoc.html>Web Developer'\''s Guide to Java Beans - Table of Contents</a></h2><br>\n'
$ cat !$
<h2><a href=reference/standard/1576101762/ewtoc.html>Visual Developer SQL Database Programming <h2><a href=reference/standard/1576101215/ewtoc.html>Web Developer's Guide to Java Beans - Table of Contents</a></h2><br>
You see it should be right(like the previous result), but it
doesn't. So do you think it is a bug?
FYI,
my debian:
$ cat /etc/debian_version
2.2
my "title_get" perl code:
- - - -
require HTML::HeadParser;
local $/;
$text=<>;
$p = HTML::HeadParser->new;
$p->parse($text) and print "not finished";
print $p->header('Title'); # to access <title>....</title>
- - - -
--
SUN Tong
Reply to: