2
votes

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.

4
Isn't Tcl inbuilt in linux? - Jerry
What Linux distribution are you using, or are you rolling your own? This affects what answer is best for you... - Donal Fellows
@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
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
Tcl is often preinstalled. Otherwise use your favorite package manager to install tcl and expect. - Johannes Kuhn

4 Answers

8
votes

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.

4
votes

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.

3
votes

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.

2
votes

on ubuntu:

 sudo apt-get install tcl