Special Variables

The following global variables have special meaning to the Tcl interpreter:

argc

Number of command-line arguments, not including the name of the script file (tclsh)

argv

List containing command-line arguments (tclsh)

argv0

Filename being interpreted, or name by which script was invoked (tclsh)

env

Array in which each element name is an environment variable

errorCode

Error code information from last Tcl error

errorInfo

Describes the stack trace of the last Tcl error

tcl_interactive

Set to 1 if running interactively, 0 otherwise (tclsh)

tcl_library

Location of standard Tcl libraries

tcl_pkgPath

List of directories where packages are normally installed

tcl_patchLevel

Current patch level of Tcl interpreter

tcl_platform

Array with elements byteOrder, machine, osVersion, platform, and os

tcl_precision

Number of significant digits to retain when converting floating-point numbers to strings (default 12)

tcl_prompt1

Primary prompt (tclsh)

tcl_prompt2

Secondary prompt for incomplete commands (tclsh)

tcl_rcFileName

The name of a user-specific startup file

tcl_traceCompile

Controls tracing of bytecode compilation; 0 for no output, 1 for summary, and 2 for detailed

tcl_traceExec

Controls tracing of bytecode execution; 0 for no output, 1 for summary, and 2 for detailed

tcl_version

Current version of Tcl interpreter

Get Tcl/Tk in a Nutshell 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.