Version 11 of tclsh

Updated 2003-02-12 20:55:25

This is an application created by default by the core distribution. It is a simple shell interpreter, and is frequently used by developers writing tcl scripts.

A user of tclsh (or of wish, the interactive tcl shell with Tk automatically loaded), should be aware that there are a few differences between typing tcl statements to the shell in interactive mode and typing tcl commands into a file and then executing it.

  1. [tcl_interactive]
interactive
this variable is set
command file
this variable is set to 0
  2. unknown proc differences - if tclsh is unable to recognize the command typed, the unknown proc is invoked.
interactive
unknown will automatically pass command to exec .
command file
the coder must specify exec before any non-tcl commands
  3. abbreviations 
interactive
the unknown command looks to see if the typed command is an unambiguous abbreviation of an existing command and, if it is, invokes it. Thus in interactive mode it's possible to write
    set fp [op $myfile]
command file
would require open be written out in full.
  4. standard output displayed 
interactive
stdout appears to the screen when you type commands
command file
the coder must specify puts to get the output from a command to display to the screen
  5. byte-compilation
interactive
prompt commands are byte compiled
command file
top level commands are not byte compiled

People writing scripts to be loaded from the tclsh command line should be aware that \u001a is an end-of-file character in scripts.


Category Application, a part of the Tcl package.