Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!sdd.hp.com!think.com!rpi!uupsi!cmcl2!adm!news From: dichter@chdasic.sps.mot.com (Carl Dichter) Newsgroups: comp.unix.questions Subject: Re: using tee program with tar output Message-ID: <26850@adm.brl.mil> Date: 10 May 91 14:42:26 GMT Sender: news@adm.brl.mil Lines: 29 This will work in bourne: $ tar cvf tarfile /tmp 2>&1 | tee tar.out But there is one caveat (and it is really true in any shell): errors will come out immediately and normal output is buffered, therefore it is harder to determine where an error actually occured. Look at the following runs: $ tar cvf $HOME/tarfile $HOME/tardir a /home/libra/carl/tardir/afile 1 blocks a /home/libra/carl/tardir/myfile 2 blocks a /home/libra/carl/tardir/okfile 2 blocks tar: /home/libra/carl/tardir/yourbadfile: Permission denied $ tar cvf $HOME/tarfile $HOME/tardir 2>&1 | tee $HOME/tar.out2 tar: /home/libra/carl/tardir/yourbadfile: Permission denied a /home/libra/carl/tardir/afile 1 blocks a /home/libra/carl/tardir/myfile 2 blocks a /home/libra/carl/tardir/okfile 2 blocks The tee'd version has the message in a misleading place. Have fun. Carl R. Dichter Staff Software Engineer/Scientist Motorola ASIC Division Chandler, AZ 85224