From: <gl...@ma...> - 2001-07-24 01:28:32
|
Forwarded message: > From: "Roland Giersig" <Ro...@a1...> > To: gl...@ma... > Cc: exp...@li... > Date: Mon, 23 Jul 2001 17:07:52 +0200 > > > 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)". Thanks :) I'm about to try it out... > > 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? ... Nope. Since you're interested, this is the guts of what I am trying to do: spawn("rsh machine dump_cmd various args... mount-point |cat -|dd bs=64k of=tape-device"); then use expect to catch the message: "End of tape reached. Press RETURN when new tape loaded ..." (message varies depending on the dump software - yes, I'm doing this from multiple machines/OSes/dump commands, each with different idiosyncrasies, arguments, etc...) When I get the expect message, I call a sub to change tapes using the tape robot. That's the plan anyway. :) Glen -- Glen Davison gl...@ma... Computer System Administrator phone: +61 2 9385 7018 Maths, UNSW fax: +61 2 9385 7123 |