A shell window
in Tycho provides a shell for interacting with
the Tcl interpreter. Note that Tk and Itcl are understood by
this interpreter, as are, of course, all Tycho commands.
If you are running a version of Tycho with Ptolemy attached,
the ptcl or pitcl commands are also understood.
(See the pitcl
page for more information).
By default, commands are executed at the global scope namespace
(::
),
but this can be changed by invoking the Set namespace
command in the Special
menu.
A shell windows is derived from the Edit window,
and therefore inherits all of its features.
This page documents the additional features provided.
Return
C-a
C-e
C-k
C-n or Down
C-p or Up
C-u
These bindings can be used to scroll back to previous commands, edit
them, and re-execute them. The bindings are designed to be maximally
convenient for single line commands, but they can still be used if the
commands themselves have multiple lines. However, it takes some
getting used to. In particular, C-p
will not move the
insertion cursor up one line a multi-line command, but rather will
erase the current command altogether and replace it with the previous
command in the command history. Similarly, C-n
will not
move down one line in a multi-line command. To edit a multi-line
command, use C-b
and C-f
or M-b
and
M-f
to move around within the command.
Note also that C-k
does not delete to the end of the current
line, but rather deletes to the end of the command.
The Shell window has a number of features designed to make it easier
to experiment with Tcl scripts. Foremost among these is the
history mechanism, which keeps a record of previously
executed commands. A Special
menu provides two commands
related to this:
Edit history
Clear history
Note that the Save As
command, unlike the
Edit History
command,
saves a snapshot of the previously executed command together with
the returned values and prompts.
Thus, it provides a mechanism for documenting an interaction
with the Tcl interpreter.
If a shell window has been designated "master" (using the -master
option), then it
will capture standard output generated by the Tcl puts
command, unless
that output is redirected to a file. If you start Tycho with a shell
window, that shell window is a master shell window.
Note that for output to appear in the master shell window it
may be necessary to call update
, update idletasks
,
::tycho::safeUpdate
.
A second feature of a master shell window is that when it is dismissed, the program is exited (after confirmation, of course).