Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

interact difficulties

I am writing a script to ssh into remote machines and run tripwire.
I'd like it to go interactive at the point the editor (vi) fires up
and to resume non-interactive mode once the file is saved.

I have a working test script:

spawn /bin/bash
expect "$"
send "vi tt\r"
interact {
        \003 return
send exit

This allows me to edit the file tt and hit CTRL-C when finished.

Here's the expect portion of the real script (it's run as a here
document, so the variables are substituted in by /bin/sh):

spawn ssh -4p8889 ${addr[$a]}
expect "$ "
send -- "sudo /usr/sbin/tripwire --check -I\r"
$pwd # deals with the sudo password
interact { ! return }
expect "Please enter your local passphrase:" { send "SANITIZED" }
expect "\$ "
send -- "exit"
expect eof

I've tried many different characters and nothing seems to work.
Ideally, I'd like the script to discern when the edit is finished and
return from interactive mode, but I had no luck with "interact -o"

Thanks in advance,


On May 14, 5:45 pm, James.E.W@gmail.com wrote:

Is there a reason the test script does not prepend the $ with a \ but
'production script' does?

On May 15, 12:47 pm, rfoxmich <rfoxke@gmail.com> wrote:

Probably a glitch, but as it happens it doesn't matter anyway:

% string equal "$" "\$"


Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc