TCL TRAINING And TUTORIAL

Tcl

In this part of the Tcl tutorial, we will introduce the Tcl programming language.
Goal

The goal of this tutorial is to get you started with the Tcl programming language. The tutorial covers the core of the Tcl language, namely variables, lists, arrays, control structures, and other core features. It is not a complete coverage of the language. It is a quick, introductory material. The tutorial was created on Ubuntu Linux.
Tcl

Tcl logo Tcl is a string based scripting language. The source code is compiled into bytecode, which is later interpreted by the Tcl interpreter. It was created by John Osterhout in 1988. The purpose was to create a language which is easily embeddable into applications. But it is often used outside its original area. The language is commonly used for rapid prototyping, scripted applications, GUIs, and testing. The Tcl stands for tool command language, where the source code of a Tcl script consists of commands.

Tcl is a procedural language. It has some functional features. OOP was added in Tcl verstion 8.6.

The official web site for both Tcl and its Tk GUI toolkit is tcl.tk
Popularity

There are hundreds of programming languages in use today. Tcl does not belong to the most popular ones. It has its own niche where it used. For instance, rapid prototyping, testing, and database interaction.
Interactive interpreter

We can run Tcl commands in a script or in an interactive interpreter. In this tutorial, we will use the interactive Tcl session to demonstrate some smaller code fragments. Larger code examples are to be put in Tcl scripts.

The tclsh is a shell-like application that reads Tcl commands from its standard input or from a file and evaluates them. If invoked with no arguments then it runs interactively, reading Tcl commands from standard input and printing command results and error messages to standard output.

$ tclsh
% puts $tcl_version
8.6
% puts $tcl_interactive
1

This is an example of a Tcl interactive session.

$ tclsh

We start the interactive session with the tclsh command.

% puts $tcl_version
8.6

The prompt changes to the % character. We print the value of a special tcl_version variable to the console. It is set to the version of the current Tcl in use.

% puts $tcl_interactive
1

The tcl_interactive variable tells us whether we are in an interactive mode.

% exit
$

We use the exit command to terminate the interactive session. It is possible to use the Ctrl+C key combination too.
Tcl scripts

We will have our first simple example of a Tcl script. It is a common practice for Tcl programs to have the .tcl extension.

#!/usr/bin/tclsh

# first.tcl

puts "This is Tcl tutorial"

In this script, we print a message to the console.

#!/usr/bin/tclsh

Every script in the UNIX starts with a shebang. The shebang is the first two characters in the script: #!. The shebang is followed by the path to the interpreter, which will execute our script. The /usr/bin/ is the most common location for the Tcl shell. It could also be located in /usr/local/bin/ or elsewhere.

# first.tcl

Comments in Tcl are preceded by a # character.

puts "This is Tcl tutorial"

The puts command prints a string to the console.

$ which tclsh
/usr/bin/tclsh

The path to the Tcl interpreter can be found using the which command.

$ chmod +x first.tcl
$ ./first.tcl
This is Tcl tutorial

We make script executable with the chmod command and execute it.

Tcl tutorial in Bangalore, tcl training in Bangalore,Networking training in Bangalore,Software testing training in Bangalore,CCNA Training in Bangalore,CCNP Training in Bangalore,CCIE Training in Bangalore,Test protocol in Bangalore,Network Test in Bangalore,Networking Basics in Bangalore,Networking fundamentals in Bangalore,L2 testing in Bangalore,TCL training in bangalore,Networking courses in Bangalore,Temporary Agency in Bangalore,Recruitment Agency in Bangalore,Agency jobs in Bangalore,Temp Service in Bangalore,Employment Agency in Bangalore,Staffing company in Bangalore,Staffing solutions in Bangalore,Temp jobs in Bangalore,Staffing services in Bangalore,Temporary services,Hiring Agency

Copyright © 2016. Designed by  www.atebytetechnologies.in