in reply to the greedy diamond, or leggo my STDIN

It does work. It just doesn't do what you expect because you don't understand filehandles properly :-)

STDIN is just another filehandle. Normally it is opened to whatever device is attached to your console. But because you are piping another program's output into your program's input, your program's STDIN is instead attached to the other program's STDOUT. It will remain attached to that until you tell it otherwise.

You might find this tutorial useful, in particular the few pages starting here.

  • Comment on Re: the greedy diamond, or leggo my STDIN