[Gllug] redirecting stdout to multiple files
Richard Jones
rich at annexia.org
Fri Dec 15 13:48:01 UTC 2006
On Fri, Dec 15, 2006 at 10:51:40AM +0000, Ben Fitzgerald wrote:
> I can redirect multiple file descriptors to write out to a single fd,
> e.g.
>
> 2>/dev/null 1>&2
>
> Is there any way to direct stdout to multiple files just using bash i/o
> redirection? similar to
Thinking about it in low-level terms, a program issues 'write(2)'
syscalls to a file descriptor which is open on a device. A file
descriptor can't be attached to multiple devices, so that would leave
two possibilities: either the program issues double write(2) syscalls,
or there is some device which can duplicate the output to two
different places.
The former (double write) is essentially what 'tee' does.
For the latter, I don't know of such a device, although there may be
one I've overlooked and it would certainly be possible to write one
(in the kernel or using a userspace system like fuse).
So I don't think what you want is going to be possible. You need to
think about an external process, maybe tee or another program that you
write.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!
-------------- next part --------------
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list