Using Built-In Functions

Built in functions allow you to manipulate and evaluate the variables inside your script and the script output. The following table shows the built-in functions. The following table shows the built-in Tool Command Language (TCL) functions.
Note

Note

ExtremeXOS uses TCL version 8.5.14.
expand icon

Built-In Functions

Syntax Function

$MATCH(string 1, string 2)

Compares the two strings string 1 and string 2. Returns 0 if string1 matches string2.

It returns -1,0, or 1, depending on whether string1 is less than, equal to, or greater than string2.

$READ(prompt)

Displays a prompt for user input and accepts input until the user presses [Return] or the session times out. Replace prompt with the prompt to display to the user.

$TCL(function args)

Calls a TCL built-in function (see the following table). Note that the software does not support the simultaneous operation of multiple TCL functions. For more information on TCL functions, go to http://www.tcl.tk/man/tcl8.3/TclCmd/contents.htm.

$UPPERCASE(string)

Returns the string uppercased.

$VAREXISTS(varname)

Returns zero if the specified variable does not exist. Returns non-zero if the specified variable does exist.

expand icon

Supported TCL Functions

Function Function Type Description

after

System related

Execute a command after a time delay.

binary

String handling

Insert and extract fields from binary strings.

clock

System related

Obtain and manipulate time.

concat

List handling

Join lists together.

expr

Math

Evaluate an expression.

join

List handling

Create a string by joining list elements together.

lindex

List handling

Retrieve an element from a list.

linsert

List handling

Insert elements into a list.

list

List handling

Create a list.

llength

List handling

Count the number of elements in a list.

lrange

List handling

Return one or more adjacent elements from a list.

lreplace

List handling

Replace elements in a list with new elements.

lsearch

List handling

See if a list contains a particular element.

lsort

List handling

Sort the elements of a list.

regexp

String handling

Match a regular expression against a string.

regsub

String handling

Perform substitutions based on regular expression pattern matching.

re_syntax

String handling

Syntax of TCL regular expressions.

split

List handling

Split a string into a proper TCL list.

string

String handling

Manipulate strings.

For examples of scripts that use TCL functions, see CLI Scripting Examples.