Shells
Alpha
Version:9.2.3 - "Suhail"
Last update:2021-05-21 14:43:31



This file documents the Tcl shell.

Tcl Shell

To open the Tcl Shell, select the Tcl Shell item in the Tools menu or use the ⌘Y keyboard shortcut. Click here to open it now.
The basic idea of the Tcl Shell is to provide an interactive way to access Tcl, it is *NOT* currently intended to serve as a pseudo-unix-shell. However, it does contain a few very useful unix shell functions.
All pathnames must be pathnames correct for your platform. This means, on MacOS X/Unix, unix pathnames with '/' as a separator, and '../' to specify a parent directory.

Supported commands

All valid Tcl commands can be executed in the Tcl shell. Additionally, some unix-like commands are supported. They are described in the rest of this section. Some of these commands are available via the TclX extension.

cat

	cat file...  
Dump contents of files into shell window.

cd

	cd relative or absolute pathname
Change directory. If called with no arguments, go to home directory.

cp

	cp file1 file2
or
	cp file1 .... destDir
Basic unix copy functionality, recursive.

grep

    grep pat file...
Grep, reasonably slow.

mkdir

    mkdir dirname
Make a directory (folder)

ls

    ls [-F|l] [file]...
Print listing. It has two mutually exclusive flags. The option -F just gives the normal display, with a * behind applications and a separator / behind directories (folders). The option -l presents a long listing, including sizes and last modification time. The file unix.tcl includes a function ll which serves as Unix alias to ls -l.

mv

    mv file1 file2          or
    mv file1 .... destDir
Move a file, potentially across volume boundaries. Recursive.

popd

    popd
Pop top dir off dir stack and cd to it.

pushd

    pushd [dir]
If dir is specified, push current folder into directory stack and cd to dir. Otherwise, swap current dir with top of dir stack.

dirs

    dirs
Show current directory stack. See pushd and popd.

ps

    ps
Print a list of active processes.

rm

    rm [-r] file...
Remove files and empty directories. The option -r allows recursive removal, but DON'T BLAME ME IF YOU DELETE YOUR ENTIRE DRIVE!

rmdir

    rmdir dirname
Remove a directory (folder).

setCreator

    setCreator creator files
Change the creator of given files, which can be glob expressions.

setType

    setType type files
Change the type of given files, which can be glob expressions.

wc

    wc file...
Count lines, words, characters.

Shell mode

The file shellMode.tcl contains Tcl code implementing the shell interface. You can change this to suit your tastes. One goody is that you can re-execute previous commands merely by moving the cursor to the line and hitting the return key. If there is no «» character on the line then, when you hit a carriage return, the return is an ordinary new line.
A primitive history mechanism can be used to move up and down the last 20 commands by using ⌃-Up and ⌃-Down at a prompt line.