Welcome, guest | Sign In | My Account | Store | Cart

Installed ActiveTCL and executed the commands "teacup install --force Expect".

I executed a script which will telnet to given ip.The following is the error.

The system cannot find the file specified. while executing "spawn telnet $Machine".

let me know,anything missed ?

Thanks, Siva.

Tcl, 25 lines
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package require Expect

exp_log_user 1

set timeout 20
set Machine [lindex $argv 0]
set UserName [lindex $argv 1]
set Password [lindex $argv 2]
set enablePassword [lindex $argv 3]

spawn telnet $Machine

send "$UserName\n"
send "$Password\n"
set enable_logged_in 1
send "en\n"
send "$enablePassword\n"
set logged_in 1

if (!$logged_in) {
    puts "\n Error while logging \n"
    exit
}

puts "\n Hiiiiiiii \n"
Created by siva prasad on Fri, 24 Sep 2010 (MIT)
Tcl recipes (162)
siva prasad's recipes (1)

Required Modules

  • (none specified)

Other Information and Tasks