1 2 3 4 5 6 7 8 9 10 11 12 13
#!/usr/bin/expect set timeout 2 expect_after default {puts "\nFAIL"; exit 1} spawn /bin/bash expect "# " send "login -f foo\r" expect "$ " send "exit\r" exit 0