tid has asked for the wisdom of the Perl Monks concerning the following question:
I'm looking to capture both STDOUT and return value from a shell cmd (i.e. from something like system or backticks).
The actual application I'm trying to use is tar as a system call from within an time scheduled backup script, first to tar source control archives to tar file, and then to tar up a group of tar files directly onto tape for offsite backup. This is a common enough task that I'm surprised that I haven't been able to find any information.
I'm interested in the output of the tar application so that I can parse through it for specific pieces of information (like time jitter associated with using tar on windows filesystems mounted through samba). I also need to write the tar output to the scripts log file.
None of the usual suspects (camel book, ram book, panther book, or alpaca book) gave any useful information that I could find, so please be gentle if this one's a no-brainer.
Any help would be greatly appreciated,
Mike
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capturing return value and STDOUT from system like calls
by BUU (Prior) on Apr 16, 2004 at 04:15 UTC | |
by ctilmes (Vicar) on Apr 16, 2004 at 13:22 UTC | |
|
Re: Capturing return value and STDOUT from system like calls
by Zaxo (Archbishop) on Apr 16, 2004 at 04:39 UTC | |
|
Re: Capturing return value and STDOUT from system like calls
by Plankton (Vicar) on Apr 16, 2004 at 04:21 UTC | |
|
Re: Capturing return value and STDOUT from system like calls
by ctilmes (Vicar) on Apr 16, 2004 at 13:19 UTC | |
|
Re: Capturing return value and STDOUT from system like calls
by zentara (Cardinal) on Apr 16, 2004 at 15:35 UTC |