iTP Secure WebServer System Administrators Guide (Version 7.5+)
Tcl Syntax Rules
A Tcl script consists of a series of commands and comments entered into a file. The following
syntactical rules apply:
• A comment consists of any single line beginning with the pound sign (#). Comments are not
executed.
For example, the following four lines are comments and therefore not executed by the Tcl
interpreter:
#
# The following directive specifies the
# location of the server contents
#
• Multiplearguments in a command are separated by spaces or tabs.
For example, the following Filemap configuration directive has two arguments separated
by tabs:
Filemap /personal/unerd/ /udir/unerd
• If an argument itself contains spaces or tabs, it must be delimited with either double quotation
marks (") or curly braces ({}). If you delimit an argument with curly braces, no command or
variable substitution (described) will occur within the argument.
For example:
Message error-forbidden {
<TITLE>Access Denied</TITLE><H1>Access Denied</H1>
You have been denied access.
}
• Arguments delimited with curly braces can be nested. These arguments can consist of
commands.
For example:
Region / {
if [HostMatch *.widget.com] {
Redirect /widget-welcome.html
}
}
• Multiple commands are separated by semicolons or by end-of-lines.
For example:
puts stdout "Hello world!" ; exit
• The backslash ( \ ) character indicates that the next character is to be interpreted literally. This
feature is useful for including special characters (such as $, [, and ]) in command arguments.
A backslash at the end of a line indicates that the command is continued on the next line.
For example:
DenyHost *.openmarket.com *.foo.com *.bar.com *.widgets.com \
*.unerd.org
• A dollar sign prefixed to a variable name indicatesvariable substitution: the value of the named
variable is substituted for its name.
For example, in the following example, the path resolves to /httpd/logs/httpd.log:
set root /httpd
ExtendedLog $root/logs/httpd.log
• Square brackets delimiting a command indicatecommand substitution: the delimited command
is to be executed immediately and its return value is substituted for the bracketed command.
For example, in the following example, if [pwd] resolves to /httpd/logs, and then path is
set to /httpd/logs:
set path [pwd]
Tcl Syntax Rules 277










