Using expect to do something on remote machine

spawn ssh user@host expect { "Password:" { send "?????\r" exp_continue } "% " { send "csh command\r" expect "% " } "> " { send "tcsh command\r" expect "> " } "$ " { send "bash command\r" expect "$ " } }
Automated expect script to login to remote machine and execute command.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.