> I am trying to do something like this:
>
> $ob=Expect->spawn("rsh machine command arg | localcmd");
>
> I get the impression that spawn cannot handle the pipeline.
Right, this is a bug, I will fix it in v1.12, which I'm testing
and preparing for release right now. But due to my pending vacation
it will only be released mid to end of august.
You can of course just patch your copy of Expect.pm, simply
substitute the "exec(@_)" inside sub spawn with "exec($cmd)".
> I am guessing that I need to do this:
>
> $ob1=Expect->spawn("rsh machine command arg");
> $ob2=Expect->spawn("localcmd");
>
> and then use interconnect ....???
This is one possiblity, but probably not the best. What is that
localcmd you want to run at the end of the pipeline?
Couldn't you just use qx(rsh machine | localcmd) instead of expect and
then process the output by regular means? I can't imagine
a case where a program within a pipe requires user interaction.
Oh, maybe rsh is asking for a password? Well, it may be easier
just to set up the whole system so no passwords are needed,
with proper .rhosts files or perhaps by substituting ssh for rsh
and using RSA keys.
Storing passwords somewhere for such a purpose is a Bad Thing (tm)
IMnsHO. You're better off in the long run to invest some thoughts
into overall system security, who has to trust whom, what different
zones of trust there are etc.
Hope this helps,
Roland
--
RGi...@cp...
|