#!/bin/bash
target="192.168.1.100"
password="123456"
/bin/expect -c "
set timeout 30
spawn ssh $target
expect {
\"*yes/no*\" { send \"yes\r\"; exp_continue }
\"*password*\" { send \"$password\r\" }
}
expect {
\"*password*\" { exit 1 }
}
"
if [ $? -eq 1 ]; then
echo
echo "ERROR PASSWORD"
fi
06-26
722
