Custom Search
Showing posts with label expect. Show all posts
Showing posts with label expect. Show all posts

Friday, August 22, 2014

How To Use expect with bash script

#!/bin/bash

username="saju"
password="saju"


expect -c "
        ##Enable debug mode
        #exp_internal 1
        #set timeout 20
        spawn ssh $username@192.168.56.101
        expect "?assword:"
        send \"$password\r\"

        ##To Get console after SSH
        interact"






Howto Debug Expect Script


#!/usr/bin/expect -f

#Enable debug mode
exp_internal 1

set timeout 20

spawn ssh saju@192.168.56.101
expect "password"
send "saju\n"


##To Get console after SSH
interact











Expect Script Example for SSH


#!/usr/bin/expect -f

#Enable debug mode
#exp_internal 1

set timeout 20

spawn ssh saju@192.168.56.101
expect "password"
send "saju\n"


##To Get console after SSH
interact