2

I am using a Tcl script to change the poller password through spawning the telnet command. I have done this with the script below, and tested it on a Windows machine after installing ActiveTcl8.5.13.0.296436-win32-ix86-threaded

spawn telnet $serNumber $pNumber
#flush stdout
expect ">"

send "Clients\r"
expect ">"

send "1\r"
expect ">"

send "Pollers\r"
expect ">"

Now I want to run same script in a Linux machine, but as I am new to Linux systems, can anybody help me that how to install tcl in linux system and get executed the same script there?

Any help is a great for me. Please provide any useful links.

New to Rails
  • 2,824
  • 5
  • 27
  • 43
Piyush
  • 5,145
  • 16
  • 49
  • 71
  • Isn't Tcl inbuilt in linux? – Jerry Apr 16 '13 at 16:07
  • 2
    What Linux distribution are you using, or are you rolling your own? This affects what answer is best for you... – Donal Fellows Apr 16 '13 at 16:09
  • @Jerry - tcl is in-built for linux? i am new to linux system. if it's in-built. so what is command to execute script there. i mean in windows i am running like `tclsh filename.tcl` – Piyush Apr 16 '13 at 16:22
  • I have a Linux Mint where I have run tcl scripts using `tclsh filename.tcl` in the bash. I don't have other versions of Linux though. – Jerry Apr 16 '13 at 16:24
  • Tcl is often preinstalled. Otherwise use your favorite package manager to install tcl and expect. – Johannes Kuhn Apr 16 '13 at 16:29
  • @DonalFellows - using Red Hat Enterprise Linux AS release 4 (Nahant Update 6) Linux version 2.6.9-67.EL – Piyush Apr 17 '13 at 04:55

4 Answers4

8

You're in luck. RHEL 4 has expect in its repositories. You can simply install it with yum:

yum install expect

and it should install expect and all its dependencies.

slebetman
  • 109,858
  • 19
  • 140
  • 171
4

You're not using Tcl, you're using expect, which is a separate program which just happens to use Tcl. To install it, do

apt-get install expect

Note that the above command is a guess as you did not tell us which Linux-based OS you're using ("Linux" is not an OS, it's just a kernel).

If you have no one to ask which system you're running, post the results of running the following commands:

uname -a
lsb_release -a
cat /etc/issue

so we could try to make an educated guess.

kostix
  • 51,517
  • 14
  • 93
  • 176
3

To install Tcl on Linux (I'm using RedHat), you can do

yum install tcl

And you will get the most recent version of tcl.

stuffatwork190
  • 147
  • 1
  • 1
  • 10
2

on ubuntu:

 sudo apt-get install tcl
Albert S
  • 2,552
  • 1
  • 22
  • 28