From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Bart Schaefer" Message-Id: <990126093954.ZM24046@candle.brasslantern.com> Date: Tue, 26 Jan 1999 09:39:54 -0800 To: Vincent Lefevre , zsh-users@sunsite.auc.dk Subject: Re: Redirection + flush? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailing-List: 2055 On Jan 26, 6:09pm, Vincent Lefevre wrote: } Subject: Redirection + flush? } } I have several programs running on several machines and I want } to redirect the error messages (from stderr) to a single file } client.err via NFS with "2>>". Is there a way to ask zsh to do } what need be so that the data are not corrupted? The short answer is, no. Once zsh opens the file descriptor and passes it as the command's standard error, what the command does with it is completely out of zsh's control. The longer answer is that it's nearly impossible to do what you ask in any case. Unless the NFS filesystems are mounted with both the "hard" and "sync" options, you have no hope of correctly interleaving output from several different machines. Even with those options set, NFS is not a reliable protocol for multiple simultaneous writers. (Some would say it's not reliable for any kind of write, but ....) If you have to do this anyway, your best bet would be to use process redirction: command 2>>(tee -a sharedfile > /dev/null) because "tee" has the kind of output-flushing behavior that you want. (Some versions of "cat" have an option to force continuous flushing, and I think GNU cat does so by default, so you might be able to use that instead of tee.) Even better would be if you could do something like: command 2>>(rsh nfshost "tee -a sharedfile > /dev/null") That is, run the "tee" commands directly on the host where the file is local, so that NFS is not involved in the write. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com