Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: regular expression matching in expect

by hbm (Hermit)
on Aug 10, 2012 at 00:45 UTC ( #986633=note: print w/replies, xml ) Need Help??


in reply to regular expression matching in expect

Am i taking the right approach

Having done a lot of this, I would:

  1. Set up an ssh-key, to log in automatically without Expect - as a non-root user.
  2. Write one Expect script for each of the (few?) commands that are interactive.
  3. Write one straightforward wrapper to tie it all together.
  4. Enable the non-root user to run the wrapper with sudo.

Something like this:

ssh admin@host "sudo /path/to/wrapper.pl"

Where the wrapper might:

... die("...") if system("/path/to/cmd1.sh")!=0; die("...") if system("/path/to/interactive-cmd-exp.pl")!=0; ...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://986633]
help
Chatterbox?
[choroba]: But the Church Fathers say Matthew was originally in Aramaic
[Discipulus]: no erix, was ironic, I could have said Hartz4
[Discipulus]: for sure they had to be in armaic, many reverse-eng errors where spot
[Discipulus]: do you know the google like translation: a rich.. as a camel through the needle hole?
[choroba]: yes, I've read about it and its probable original form

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2017-11-23 20:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (338 votes). Check out past polls.

    Notices?