
You need to pull the old switcheroo on the file descriptors.
From the bash cookbook:
$ ./myscript 3>&1 1>stdout.logfile 2>&3- | tee stderr.logfile It in effect swaps stdin and stderr then closes file descriptor 3 once it is finished. (the reason for the - at the end of 2>&3-) (I googled "tee standard error" ;-) Credit where it's due. Regards, Morrie.
-----Original Message----- From: luv-main-bounces@luv.asn.au [mailto:luv-main-bounces@luv.asn.au] On Behalf Of Adam Bolte Sent: Monday, 30 September 2013 5:54 PM To: luv-main@luv.asn.au Subject: Re: Capturing output
On Mon, Sep 30, 2013 at 03:46:55PM +0800, Jay Amorin wrote:
Now I want to store the output (standard out/error) to a log file for future reference using this:
svnadmin dump -r1:100 --incremental /srv/my_repo > /srv/my_repo.1- 100.dump | tee /srv/my_repo.1-100.log
But seems not to work. Is this doable with bash or python?
I think that's taking standard output, and redirecting it to a file. Then you're piping to tee, which doesn't really do anything since you've already redirected standard output to a file.
Maybe try:
svnadmin dump -r1:100 --incremental /srv/my_repo 2>&1 | tee /srv/my_repo.1-100.log
The 2>&1 bit makes standard error go to wherever standard output is going, and then pipes standard output to tee.
-Adam