I just tried using the tctee program as follows:

#!/usr/local/bin/perl5.6 -w
use strict;

my $logFile ='<dir location>/automateLabelPush.log'; //line 5
my $tee_cmd = '<dir location>/tctee.pl';
my $cmd1 = qq{ <some command>};
system("$cmd1 | $tee_cmd -a $logFile") ;

at the end of the execution, I still get
sh: syntax error at line 5: "|" unexpected 


On Wed, 16 Mar 2005 16:14:06 -0500 (EST), Chris Devers
<[EMAIL PROTECTED]> wrote:
> On Wed, 16 Mar 2005, Paul Ohashi wrote:
> 
> > I can't see enough to determine why your script is failing, but
> > the four lines below work as expected:
> >
> > #!/usr/local/bin/perl
> > $logFile = '/home/paulo/mylog.log';
> > $myCmd = 'ls -l';
> > system ("$myCmd | tee -a $logFile");
> >
> > Hope this helps...
> 
> Is there some reason that everyone has latched onto the system `tee`
> command rather than doing this in Perl?
> 
> The "tctee" program shown in _Perl Cookbook_ (either edition) shows how
> to do this directly in Perl. The program in question can be downloaded
> from the book's site (click on "examples")  --
> 
>     <http://www.oreilly.com/catalog/cookbook/>
>     <http://www.oreilly.com/catalog/perlckbk2/>
> 
>  -- or from this Sourceforge page --
> 
>     <http://pleac.sourceforge.net/pleac_perl/filecontents.html#AEN487>
> 
> There's no clear reason to prefer an external program to do this job.
> 
> --
> Chris Devers
>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to