iTP Secure WebServer System Administrators Guide (Version 7.5+)

Table 38 Tcl Expression Operators (continued)
DescriptionOperator
Logical OR. Produces a 0 result if both operands are zero;
1 otherwise. Valid only for numeric operands (integers or
floating-point).
||
If-then-else, as in C. If x evaluates to nonzero, the result is
the value of y. Otherwise, the result is the value of z. The
x operand must have a numeric value.
x?y:z
if expression if_true [else if_false]
The if command provides conditional execution for controlling the flow of execution in a Tcl script.
If expression evaluates to a nonzero result, the if_true statement is executed; otherwise, the
if_false statement (if specified) is executed. For example, the following command sets the
variable x to zero if its value was previously negative:
if {$x < 0} { set x 0 }
switch value { pattern command pattern command ...}
The switch command provides conditional execution on the basis of a pattern matching a specified
value. The switch command compares value against each listed pattern and executes the
command associated with the first match. If one of the patterns is default, the command associated
with this pattern will be executed if no match occurs. For example:
switch $x {
*.company.com { set flag 1 }
*.widgets.com { set flag 2 }
default { set flag 3 }
}
In this example, if the value of x matches *.company.com, flag is set to 1. If x matches
*.widgets.com, flag is set to 2. If no match occurs, flag is set to 3.
string match pattern string
The string match command provides string matching. If pattern matches string, the command
returns 1 (indicating true); otherwise, it returns 0.
info exists variable
The info exists command determines if a variable or array element exists. If variable exists,
the command returns 1 (indicating true); otherwise, it returns 0. For example, the following command
will return 1 if the array element HEADER(item) exists:
source filename
The source command executes the contents of filename as a Tcl script. For example, the
command
source config.tcl
executes the contents of config.tcl as a Tcl script.
Tcl provides a core set of command procedures, a complete list of which you can find in any Tcl
resource.
The Tcl command procedures provided by the iTP Secure WebServer are called configuration
directives. These are described in detail in “Configuration Directives” (page 198).
Script Commands 281