How to get expect to set a bash variable -


i following expect script set variable in main bash script. in other words set $ssh_success pass/fail string. have tried using $expect_out , $::env(ssh_success) have been unsuccessful. how set bash variable expect?

expect << eof log_user 0 log_file $test_log set timeout 5 spawn ssh root@$radio_ip  ..... ....expect script, echoing return of ssh command...  send "echo\$?\n" expect {   "0" {         send_user "ssh test: passed\r"         ssh_success="passed"       }   "1" {         send_user "ssh test: failed\r"         ssh_success="failed"       }   sleep 1 send_user "\n" exit  eof        echo $ssh_success 

i don't know expect, think it's this

ssh_success=$(expect <<eof ... expect {   "0" {         puts "passed"       }   "1" {         puts "failed"       } ... eof )  echo $ssh_success 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -