On Mon, 11 Sep 2006, hackmiester (Hunter Fuller) wrote:
> On 8 September 2006, at 08:10, Lasse Edlund wrote:
> > If I have two files "foo" and "bar" and try to run diff on them I write:
> > $diff foo bar
> > I can also write
> > $cat foo | diff - bar
> > But how do I give a program two (2) commands? not only to diff
> > but to any program that wants double input...
> > I wanna do
> > $cat foo | cat bar | diff - -
> The entire purpose of cat is to concatenate files (make them output one after
> another). So, do:
> cat foo bar | diff - -
This advice is wrong.
To answer the original question: the shell pipe connects the stdout of
the first process to the stdin of the second process using a pipe. The
stock shells don't have a way of doing what you're after. If you have
fdescfs mounted, ksh can do something like what you're after using the
diff <(cat foo) <(cat bar)
zsh supports something similar and can work around the lack of fdescfs.
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661 http://ioctl.org/jan/
( echo "ouroboros"; cat ) > /dev/fd/0 # it's like talking to yourself sometimes
firstname.lastname@example.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"