Advertisement

06.03.2008 at 09:21AM PDT, ID: 23453726
[x]
Attachment Details

Perl - Sending command output to logfile

Asked by credog in Perl Programming Language

Tags: Open Source, Perl, Perl on Linux system, Perl, Linux

I have to troubleshoot a issue and need to modify a perl script to append the output of a command within the perl script to a log file rather than overwrite it.  Here is the line I need to change:

$result = `command > /var/log/logfile`;

command is defined at the top of the script like so:

my command = $path . "Bashscript.sh"

I'm a bash scripter not a perl scripter.  To append the output of the command to a log file I would simply use ">>" versus the singe ">".  Can I do this in perl?  So the line would read:

$result = `command >> /var/log/logfile`;

This is a important production machine, so I wanted to make sure before I did this.  This would only be temporary, I would change it back later.Start Free Trial
[+][-]06.03.2008 at 09:33AM PDT, ID: 21702083

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Tags: Open Source, Perl, Perl on Linux system, Perl, Linux
Sign Up Now!
Solution Provided By: SmartIntel
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.03.2008 at 10:04AM PDT, ID: 21702357

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628