Expect - Solaris 2.8
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Expect - Solaris 2.8

From: alf <amnon.friling@citicorp.com>
Date: Thu Dec 22 2005 - 20:57:11 CET

Hi

The following script was created to automate the installation of a
software program running
in the Solaris 2.8 environment. Script partially works, but fails to
exit back to the shell
after completing the software installation. How do I get the script to
exit back out to the
shell?

Script listed below:

ripken1# more expect.test
#!/export/opt/expect/5.39.0_B0/bin/expect -f

set force_conservative 0 ;# set to 1 to force conservative mode even
if
                          ;# script wasn't run conservatively
originally
if {$force_conservative} {
        set send_slow {1 .1}
        proc send {ignore arg} {
                sleep .1
                exp_send -s -- $arg
        }
}

set timeout -1

spawn /var/tmp/Postinstall/sparc/esm60/esmsetup

expect "2]:"
send "2\r"
expect -exact "\r"
send -- " "
expect -exact "\r"
send -- " "
expect -exact "\r"
send -- " "
expect -exact "\r"
send -- " "
expect -exact "\r"
send -- " "
expect -exact "\r"
send -- " "
expect -exact "\r"
send -- " "
expect -exact "\r"
send -- " "
expect -exact "\r"
send -- " "
expect -exact "\r"
send -- " "
expect "D]:"
send -- "a\r"
expect "1]:"
send "\r"
expect "]:"
send "/export/opt/esm\r"
expect "0]:"
send "/var/tmp/Postinstall/sparc/esm60/esm.tgz\r"
expect "Managers:"
send "whgesmn1p.ny.ssmb.com\r"
expect "0]?"
send "5600\r"
expect "M]:"
send "JSTART\r"
expect "Password:"
send "h00kup\r"
expect "1]:"
send "[exec hostname]\r"
expect "2]:"
send -- "2\r"
#interact
#send -- "^C\r"
send "exit\r"
expect eof #It hangs at this point and will not exit.
 I have to send
                             #a Cntrl C to break out of it.

Thanks
alf
Received on Fri Dec 23 19:03:03 2005