Chapter 2

The Mechanics of Using the Tcl and Tk Interpreters

The first step in learning a new computer language is learning to run the interpreter/compiler and creating simple executable programs. This chapter explores the following.

• The mechanics of starting the interpreters

• Starting tclsh and wish scripts in interactive mode

• Exiting the interpreter

• Running tclsh and wish scripts from files

2.1 The tclsh and wish Interpreters

The standard Tcl/Tk binary distribution includes the following two interpreters.

tclsh A text-oriented interpreter that includes the core commands, looping constructs, data types, I/O, procedures, and so on. Tclsh is useful for applications that do not require a GUI.

wish A GUI-oriented extension to the

Get Tcl/Tk, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.