Stdin Package Description


package require stdin


The stdin package provides a text console for entering Tcl commands to tclsh while allowing it to be event driven. To access the stdin package, include the code:

in your script, and start the tcl event loop (and the stdin console) by entering: that takes as an optional argument, a command prompt string. In addition to providing normal command entry, stdin provides a rudimentary command history, loosely inspired from csh. Any command that begins with (!) is looked up in the history list, allowing a previous command to be re-executed. The general for of a history command is:

As an example, if the command:

is the most recent command on the history list beginning with "s", then: would run the command:


State for the stdin package is stored in the global array: Stdin.


Stephen Uhler