Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > file redirection

Reply
Thread Tools

file redirection

 
 
paul_0403@yahoo.com
Guest
Posts: n/a
 
      10-27-2008
I have a perl program that opens and writes to a logfile, this all
works
well.

ie

if (! open (LOG, ">>$logfile"))
{
print STDERR "Cannot open logfile $logfile $!\n";
exit 1;
}

print LOG "Hello world\n"

I want to redirect the outpuf of a system command ot the same
log but I am having trouble getting it to work.

Can I do something like this? If not, how can I get this to work.
system("kill -USR1 \"$1\" > LOG 2>\&1");

When I issue this command on the command line I get a permissions
problem. When I run it from the perl script I was expecting to see the
same permssion problem in my log file.

THanks to all who answer

 
Reply With Quote
 
 
 
 
Joost Diepenmaat
Guest
Posts: n/a
 
      10-27-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:

> I have a perl program that opens and writes to a logfile, this all
> works
> well.
>
> ie
>
> if (! open (LOG, ">>$logfile"))
> {
> print STDERR "Cannot open logfile $logfile $!\n";
> exit 1;
> }
>
> print LOG "Hello world\n"
>
> I want to redirect the outpuf of a system command ot the same
> log but I am having trouble getting it to work.
>
> Can I do something like this? If not, how can I get this to work.
> system("kill -USR1 \"$1\" > LOG 2>\&1");
>
> When I issue this command on the command line I get a permissions
> problem. When I run it from the perl script I was expecting to see the
> same permssion problem in my log file.


You really should read the answers given before you re-post your
code in a slightly different (but still misguided) form.



--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File System Redirection Windows x 64 box. Rohit Srivastava Python 2 05-15-2009 01:02 PM
redirection in a file with os.system TP Python 2 11-04-2008 05:58 AM
detecting EOF using cin with file redirection iaesun@yahoo.com C Programming 7 08-02-2006 05:17 AM
File Download and page redirection from one click James T Kirk Javascript 2 08-21-2003 01:36 PM
exit! affects stdout redirection to a file Gennady Ruby 0 06-27-2003 11:41 PM



Advertisments