This one time, at band camp, Ian Jackson said:
> Matthias Klose writes ("Re: Bug#320036: bash exits 0 on errors reading stdin 
> (and perhaps other scripts) (forwarded from Ian Jackson)"):
> > Chet Ramey writes:
> > > No shell behaves as the submitter describes.  Read errors are translated
> > > to EOF, and the shell exits.  The exit value is $?, which is changed by
> > > the last command (pipeline) executed or by a signal.
> > 
> > closing the report.
> 
> With this interpretation it is impossible to write any reliable
> shell script.
> 
> bash already invents a nonzero exit status if (for example) the script
> cannot be opened.  It should do the same if the script cannot be read.
> 
> I will be reopening this report while we discuss it.

[EMAIL PROTECTED]:~$ bash 0; echo $?
bash: 0: No such file or directory
127
[EMAIL PROTECTED]:~$ bash 0>/dev/null; echo $?
0

The problem isn't in bash's setting of the exit status, the problem is
your last command was the redirection, and it completed successfully.
This is arguably incorrect, but it is not the same problem, I think.

Take care,
--
Stephen Gran
[EMAIL PROTECTED]
http://lobefin.net/~steve


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to