Alttaki script ile ssh kullanarak otomatik ssh server olan herhangi bir yere bağlantı sağlayabilirsiniz.
#!/bin/bash
HOST="baglanilacak ip adresi yada dns name yazın"
USER="kullanici"
PASS="sifre"
CMD=$@
VAR=$(expect -c "
spawn ssh -o StrictHostKeyChecking=no $USER@$HOST $CMD
match_max 100000
expect \"*?assword:*\"
send -- \"$PASS\r\"
send -- \"\r\"
expect eof
")
echo "==============="
echo "$VAR"