Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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/"

Where the wrapper might:

... die("...") if system("/path/to/")!=0; die("...") if system("/path/to/")!=0; ...

Comment on Re: regular expression matching in expect
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://986633]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2015-12-01 00:20 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (788 votes), past polls