#!/usr/bin/perl -w use strict; # tee program #### tee.pl ###### # quickie tool $| =1; #flushes I/O for each write. sub usage { print "TEE USAGE:\n tees stdout to a file and to stdout\n". " program | tee outfile\n"; } my $filename = shift @ARGV; usage unless $filename; open (OUTFILE, '>', "$filename") or (die "Can't open OUTFILE: $!"); while (<>) { print; print OUTFILE; }
In reply to Re^2: Building a log file
by Marshall
in thread Building a log file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |