01-Fundamentals Configuration Guide

HomeSupportResource CenterSwitchesH3C S7500X Switch SeriesH3C S7500X Switch SeriesTechnical DocumentsConfigureConfiguration GuidesH3C S7500X Switch Series Configuration Guides-Release758X-6W10001-Fundamentals Configuration Guide
13-Tcl configuration
Title Size Download
13-Tcl configuration 51.03 KB

Using Tcl

Comware V7 provides a built-in tool command language (Tcl) interpreter. From user view, you can use the tclsh command to enter Tcl configuration view to execute the following commands:

·           All Tcl 8.5 commands.

·           Comware commands.

The Tcl configuration view is equivalent to the user view. You can use Comware commands in Tcl configuration view in the same way they are used in user view. For example, you can perform the following tasks:

¡  Use the system-view command to enter system view to configure features.

¡  Use the quit command to return to the upper-level view.

Using Tcl to configure the device

When you use Tcl to configure the device, follow these guidelines and restrictions:

·           You can apply Tcl environment variables to Comware commands.

·           No online help information is provided for Tcl commands.

·           You cannot press Tab to complete an abbreviated Tcl command.

·           Make sure the Tcl commands can be executed correctly.

·           As a best practice, log in through Telnet or SSH. You cannot stop Tcl commands by using a shortcut key or a CLI command. If a problem occurs when the Tcl commands are being executed, you can terminate the process by closing the connection if you logged in through Telnet or SSH. If you logged in from the AUX line, you must perform one of the following tasks:

¡  Restart the device.

¡  Log in to the device by using a different method, and use the free line command to release the console line. For more information about the command, see Fundamentals Command Reference.

·           You can press Ctrl+D to abort Tcl command read stdin.

To use Tcl to configure the device:

 

Task

Command

Remarks

Enter Tcl configuration view from user view.

tclsh

N/A

Execute a Tcl command.

Tcl command

You can use a Comware command to enter a subview under Tcl configuration view to configure the device.

Return from a subview under Tcl configuration view to the upper-level view.

quit

N/A

Return from a subview under Tcl configuration view to Tcl configuration view.

Press Ctrl+Z.

N/A

Return from Tcl configuration view to user view.

·          tclquit

·          quit

The tclquit command is available only in Tcl configuration view.

 

 

NOTE:

·       The tclquit command has the same effect as the quit command in Tcl configuration view.

·       If you have used a Comware command to enter a subview under Tcl configuration view, you can only use the quit command, instead of the tclquit command, to return to the upper-level view.

 

Executing Comware commands in Tcl configuration view

Follow these restrictions and guidelines when you execute Comware commands in Tcl configuration view:

·           To specify a string enclosed in quotation marks (") or braces ({ and }), you must use the escape character (\) before the quotation marks or braces. For example, to specify "a" as the description for an interface, you must enter description \"a\". If you enter description "a", the description is a.

·           For Comware commands, you can enter ? to obtain online help or press Tab to complete an abbreviated command. For more information, see "Using the CLI."

·           The cli command is a Tcl command, so you cannot enter ? to obtain online help or press Tab to complete an abbreviated command.

·           Successfully executed Comware commands are saved to command history buffers. You can use the upper arrow or lower arrow key to obtain executed commands.

·           To execute multiple Comware commands in one operation:

¡  Enter multiple Comware commands separated by semi-colons to execute the commands in the order they are entered. For example, vlan 2;description Tech.

¡  Specify multiple Comware commands for the cli command, quote them, and separate them by a space and a semicolon. For example, cli "vlan 2 ;description Tech".

¡  Specify one Comware command for each cli command and separate them by a space and a semicolon. For example, vlan 2 ;cli description Tech.

To execute Comware commands in Tcl configuration view:

 

Step

Command

Remarks

1.      Enter Tcl configuration view

tclsh

N/A

2.      Execute Comware commands directly.

Command

Use either method.

If you execute a Comware command directly, a Tcl command is executed when the Tcl command conflicts with the Comware command.

If you execute a Comware command by using the cli command, the Comware command is executed when it conflicts with a Tcl command.

3.      Execute Comware commands by using the cli command.

cli command