Could you please help me in writing a sample code to connect the remote system (through ssh) using expect in shell script.
Please find sample piece of code written as given below..
#!/bin/bash
HOST="148.147.179.118"
USER="root"
PASS="spirit"
expect -c "
# exp_internal 1 # uncomment for debugging
spawn ssh root@$HOST
expect {
"*password:*" { send $password\r\n; interact }
eof { exit }
}
exit
"
Am getting the error "*Command not found *, prompting for password, connecting to the system after giving password but not returning from the remote system.
Can anyone help me with some solution.