1

Possible Duplicate:
Is there a way in bash to redirect output and still have it go to stdout?

How would I send /dev/stdin to both /dev/stdout and a $logfile in one command?

One solution would be just to do it once for both:

 cat /dev/stdin > $tempfile;
 cat $tempfile > /dev/stdout;
 cat $tempfile > $logfile;

But that seems bad. Is there a better way?

Stefan
  • 25,300

1 Answers1

7

The command tee is exactly doing this :

cat /dev/stdin | tee $logfile
jon_d
  • 1,043