On Tue, 11 Jun 2013 01:39:47 -0400
Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote:

> On 6/11/13 12:16 AM, Infiltrator wrote:
> > On Tuesday, 11 June 2013 at 04:04:03 UTC, David Nadlinger wrote:
> >> On Tuesday, 11 June 2013 at 04:02:59 UTC, Andrei Alexandrescu
> >> wrote:
> >>> The test program is flawed; writeln() writes to stdout, and the
> >>> redirection is to stdin.
> >>
> >> Wouldn't stdin be fd 0?
> >>
> >> David
> >
> > What David said. Here's the same thing done to a cat (poor kitty):
> >
> > $ cat 1</dev/null
> > test
> > cat: write error: Bad file descriptor
> 
> No, this is also wrong. cat reads and writes, "hello world" only
> writes. Consider:
> 
> echo meh 1</dev/null
> 
> Always succeeds.
> 

I just tried both on Debian 6:

nick@debian6:~$ cat 1< /dev/null
cfws
cat: write error: Bad file descriptor
nick@debian6:~$ echo meh 1< /dev/null
bash: echo: write error: Bad file descriptor

Maybe OSX behaves differently?

Reply via email to