Hi all,
I want to connect to some host with "ssh". I have googled and got some commands of "expect" and "spawn". I was not aware of these commands and tried below script.
$ cat auto.sh
set host xx.xx.xx.xx
set password abcd@1234
set user root
spawn ssh $user@$host
expect "*?assword:*" { send -- "$password\r" }
send -- "\r"
expect eof
But getting the below error
./auto.sh: line 6: spawn: command not found
couldn't read file "*?assword:*": no such file or directory
./auto.sh: line 8: send: command not found
couldn't read file "eof": no such file or directory
Please let me know the errors in the script.
$ echo $SHELL
/bin/bash
Thanks..