On Wed, Jun 20, 2001 at 04:21:07PM -0400, Yacketta, Ronald wrote:
> I have tried that, but exec fails...
> exec ( 'egrep', "-c" , $lookFor , @{$LOGS[($_ -1)]} ) unless $pid=fork; #
> fork new process for cmd
>
> is my current line.. I have tried several different ways to add the > out
> and no go
> exec ( 'egrep', "-c" , $lookFor , @{$LOGS[($_ -1)]}, " >out" ) unless
> $pid=fork; # fork new process for cmd
> results in an error unknown command > out
You can't mix the list form of exec with shell redirects; you can have one
or the other, but not both. The reason being the list form of exec is there
to explicitly bypass the shell interpolation of your command line.
If you insist on using egrep and redirection you'll have to join your
command line into one string, making sure to carefully quote anything in
your variables. Otherwise, I would suggest implementing egrep -c in Perl.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--