On Feb 7, 2008 1:43 PM,  <[EMAIL PROTECTED]> wrote:
> On Feb 5, 9:26 pm, [EMAIL PROTECTED] (Rob Dixon) wrote:
> >
> > Can you see now why you're getting a syntax error?
> >
> > But your concept is far too convoluted. You have a Perl process that's
> > shelling out to another Perl process, that in turn is shelling out to
> > run rsh and/or ssh. Also, where are $srcdir and $destdir coming from?
> >
> > I suggest you rewrite as a Perl program that shells out, if necessary
> > only one level to rsh, and verifies the return status to determine
> > whether to also use ssh in the same way.
> >
> > I hope this helps a little.
> >
> > Rob
>
> Bit new to this so may sound like a simple question, but doesn't the
> "||" mean if argument 1 fails run argument 2 - at least this is the
> case in ksh (not sure if the same rule applies to perl).  If this is
> true then would'nt this spawn only one process?
>

No. See my earlier response. You have your perl script. let's call
this perl(1). You then store up a shell command line in $cmd. When you
call the code in $cmd, using either system() or exec(), a shell will
be spawned to execute the code. We'll call that sh(1). The code
executed by sh(1) contains the shell command 'perl' to which you pass
the runtime flag -e and the argument 'alarm(5); exec...'. That causes
the shell to spawn a child perl process to execute your embedded code.
We'll call that perl(2). The code executed by perl(2) in turn includes
an exec(), which spawns a shell to execute the subsequent code. We'll
call this sh(2). sh(2) then spawns an rsh process.

So, your execution looks like this:

perl(1) -> spawns sh(1) -> spawns perl(2) -> spawns sh(2) -> spawns (rsh?)

What the sh(2) actually spawns is up for debate. You're passing a long
set of operators and flags to your commands, so I would say it's an
open question whether the shell will execute rsh or scp, or whether it
will execute rsh and pass  '|| scp...' as an argument to rsh that will
cause a syntax error. Parentheses would be your friends, here.

More importantly, though: there is no reason not handle all the logic
in Perl. I suggested one way to accomplish that in my previous post.

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.downloadsquad.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to