1

I have problem with my simple code, the expect can not expect the output

set timeout 10
set user username
set password password
spawn  ssh $user@000.000.000.000
expect "Password:"
send "$password\r"
expect eof
send "cv mk ghassan-test-5\r"
sleep 45
expect "ok" { send "cv set ghassan-test-5\r" }
sleep 20
expect -gl "Ok" { send "cv rbset ghassan-test-5\r" }
expect eof
sleep 20
expect -gl "Ok" { send "cv ls\r" }
sleep 10
expect eof`
send "exit\r"

the script run and and enter to the remote server but after send "cv mk ghassan-test-5\r" the output is generated, ..... Please wait while database is writing to disk. Writing the database file can take minutes... ok, but when the script run the next line expect "ok" { send "cv set ghassan-test-5\r" } it did not run and did not expect the ok since the ok but if i expect minutes insted of ok it work fine (the ok appear after 1 minute)

Anthon
  • 79,293

0 Answers0