A script is a sequence of commands, separated by a semicolon or newline, that an interpreter can evaluate. It is also usable as data format.

More generally, a script is a set of statements written in the language of an interpreter such as Tcl.

See Also

The rules of Tcl.
Many ways to eval
Enumerates the ways to evaluate a string as a script.
Splits a script into its constituent commands.
scripted list
Performs substitutions on the words of each command in a script and then concatenates the commands into a single list.


A script can be provided to Tcl in various ways:

Invocation of an interpreter such as tclsh
The name of a file containing the script can be passed as an argument.
The name of a file containing a script can be passed as an argument.
Concatenates arguments into a script and evaluates it.
script substitution
A script is embedded into a command in a larger script.

A script often provides a library for use by other scripts.

Tcl's sparse syntax makes it particularly convenient to embed code written in another language directly into a Tcl script. SQL, Perl, ksh, awk, or even C code can then be handed off to to some other interpreter for evaluation. SQL is probably the most well-known example of this. When generating scripts for another language, it is necessary to be aware of possible injection attacks.