Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: system and pipes

by matija (Priest)
on Jan 18, 2006 at 15:24 UTC ( #523991=note: print w/ replies, xml ) Need Help??


in reply to system and pipes

It is commendable that you're calling system with an array of references, because that avoids some of the shell exploits.

However, since you intend to use shell redirection to accomplish your command, you can't do it this way.

The easy way to do it would be:

system("$tar $taropts $backupdir | $ssh $user\@$remotehost 'dd of=$rem +otedir/back.tar.gz'")
The hard way would be starting tar in one process, the ssh/dd in another, and playing the IPC between them. Comparatively hard, for very little gain.

In effect, you'd have to reimplement the shell redirects in order to do it. It's easier to just use the shell's redirects, and fortunately, Perl makes that possible.


Comment on Re: system and pipes
Download Code
Re^2: system and pipes
by FourierXForm (Acolyte) on Jan 18, 2006 at 15:32 UTC
    Thank you very much. It worked perfectly!!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://523991]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-09-20 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (158 votes), past polls