Date: Sun, 26 Dec 1999 10:13:11 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: "Mark E." cc: djgpp-workers AT delorie DOT com, François Pinard Subject: A problem with ported Bash and redirection Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Consider the following simple shell script: echo foo echo bar echo baz Now let us run the ported Bash 2.03 thusly: sh < script You will see what you expect: foo bar baz Now modify the script like this: echo foo < /dev/null echo bar echo baz and run it again. Surprise! what we see is just one line: foo Try moving the redirection from line to line, and you will see the trend: the first line which redirects stdin to the null device is the *last* line that is ever executed in that script; the rest are ignored. This looks like a bug in the ported Bash. Mark, I'm guessing that Bash redirects its stdin before invoking each command, but doesn't restore the old stdin after the command returns. So it hits EOF right after the first redirection, and exits.