#! /usr/bin/python import os import sys from select import select targets = [sys.stdout] for filename in sys.argv[1:]: f = open(filename, "w") targets.append(f) targetfds = [] for f in targets: targetfds.append(f.fileno()) src = sys.stdin.fileno() while 1: (r, w, x) = select([src],[],[]) str = os.read(src,1) if str == '': break for fd in targetfds: os.write(fd, str) for f in targets: f.close()