Clear questions and runnable code
get the best and fastest answer
Error using system() and tar with several optionsby gctaylor1 (Hermit)
|on Apr 13, 2009 at 21:16 UTC||Need Help??|
gctaylor1 has asked for the
wisdom of the Perl Monks concerning the following question:
I'm trying to replace a working bash script that uses tar and ssh, with a perl script using system() and the OS(Linux) provided tar and ssh, and am having trouble getting all of the options to work.
I'm trying to piece it together one step at a time and so far this is all I can get working:
If I try adding things like --exclude-from=$localdir I get various errors depending on where I put the--exclude-from.
Here's the line from the working bash script I'm trying to copy.
At this point I haven't tried to get the other options working as I thought this would be the simplest. I suspect piping the output to ssh will be a challenge as well and am saving that for last.
In the process of trying to get this working with system() I wondered if I should really be using Archive::Tar and Net::SSH::Perl? My primary reason for using the OS provided tar and ssh is that I thought it would be simpler and provides behavior that I'm familiar with. Then once I had this working I could switch to the more complex(?) task of using Archive::Tar and Net::SSH:Perl.
Any advice or pointers?
And to keep this all in perspective, I'm doing this project for learning purposes. I've been working my way through Perl books but am tired of doing exercises and want something useful to do.
Here's the full script:
Which produces the error: