All output at console and in a file at same time ?

I have several backup scripts I am improving which involves mksysb, savevg and tar.

Is there a way to have the output of any command sent to the standard output as usual (terminal) and at the same time, send a copy of it all into a file ? Normal outputs and error outputs.

Even if I am checking the status of the backup process, I know my client. They will ask that I display on the terminal the output of the backup so they see it running. But if there is a problem, scrolling the window all the way back to the start of the backup will not be possible (too much output). So if I can send all the output to a file, I could either do a grep from it to spot the error or let the operator view the file to find the errors himself (media error, ...).

added comments...
I saw similar posts done. I am checking them out...

Forgot to mention I am on AIX 4.2 with Korn shell

added comments ...
testing it with TAR

tar cvfpdl /dev/rmt0 . 2>&1 | tee -a /tmp/test.log

it only displays and copies the warnings/errors

tar cvfpdl /dev/rmt0 . | tee -a /tmp/test.log
does the same thing. I need the whole thing on console and in a file.

will continue to check other threads... (by the way, after each backup actions, I am checking the $? status for status and do actions accordingly).

The tee command seems to be working for me but I'm not sending anything to tape and I'm on AIX 5.3 so maybe that's the difference.

Another way to do this would be to send the output to a file and then do a 'tail -f' for the end user to see. Something like:

tar -cvfpdl /dev/rmt0 ./some_dir 1>/tmp/tar.out 2>&1 &
tail -f /tmp/tar.out &

You'll have to do a while loop to watch for when the tar command is completed so you know when to stop the 'tail -f', otherwise it'll never end.

HTH