how to automate telnet thro' expect cmd

From: karthikeyan (thegreatkarthik_at_yahoo.co.in)
Date: 07/31/03


Date: 31 Jul 2003 05:31:27 -0700

sir,
 I want to automate my telnet connection(instead of typing
repeated username & password)
I suppose i can write expect script

#!/usr/bin/expect

eval spawn telnet ip
set timeout 20
expect login:
send "username\r"
expect password:
send "password\r"
sleep 2
interact

when i 'm running sh scriptname i 'm getting the error "command
spawn not found"
i removed the spawn
even the system says

 telnet hostname
login:
(but it didn't proceeds with username & passwd which i send in the
script
help me



Relevant Pages

  • cron problems
    ... I am having some trouble with an expect script I am running from cron. ... script uses expect to spawn a telnet session and do some work. ...
    (linux.redhat)
  • Re: Help with expect script
    ... I have the telnet portion ... Below is my script. ... set Receiver [lindex $argv 0]; ... spawn telnet $Receiver ...
    (comp.lang.tcl)
  • Re: cron problems
    ... The script uses expect to spawn a telnet session and do some ... >> correctly in cron. ...
    (linux.redhat)
  • how to automate telnet thro expect cmd
    ... I want to automate my telnet connection(instead of typing ... repeated username & password) ... I suppose i can write expect script ... eval spawn telnet ip ...
    (comp.os.linux)
  • Re: how to automate telnet thro expect cmd
    ... > I want to automate my telnet connection(instead of typing ... > repeated username & password) ... > eval spawn telnet ip ... You don't "sh scriptname", it's an expect script not an sh script. ...
    (comp.os.linux)