Automated Testing-TCL scripting language, automated-tcl scripting language

Source: Internet
Author: User

Automated Testing-TCL scripting language, automated-tcl scripting language

TCL is a scripting language. It was first called "Tool Command Language" "Tool Command Language", but it does not mean it now, but we still call it TCL. Created by John Ousterhout. TCL is very studious and powerful. TCL is often used for rapid prototyping, Script Programming, GUI and testing.

Tcl is an interpreted language. Unlike other advanced languages that need to be compiled and joined, it directly interprets and executes each statement in sequence like other shell languages.
The Tcl data type is simple. For Tcl, there is only one type of data to be processed-a string. Tcl stores variable values in the form of strings, regardless of their actual usage type.
The embedded toolkit provides simple and rich graphic functions, allowing you to easily create a simple graphic interface.
Tcl provides interactive command interfaces, including tclsh and wish. Tclsh only supports Tcl commands, while wish supports Tcl and Tk commands. Through the interactive interface, we can execute commands one by one, just like running UNIX shell commands, and get the execution results instantly.
Tcl/Tk provides cross-platform support. The Tcl language can run on most popular UNIX, WINDOWS, and Macintosh systems, and the commands are common, but the startup details are somewhat different.
Good compatibility between Tcl/Tk and C/C ++. The Tcl/Tk script can be well integrated into C/C ++ programs.

 

1. Install TCL

Please refer to the software homepage: http://www.tcl.tk/. the latest version is tcl/tk 8.6.4.


2. Use TCL

After the installation is complete, open tclsh.exe to be the tcl interpreter. Enter simple characters.



3. Simple Example

Test. tcl source code

#! /Bin/sh # simple example set foo "john" puts "Hi my name is $ foo" set month 2 set day 3 set year 97 set date "$ month: $ day: $ year "puts $ dateset foo" puts hi "eval $ foo
for {set i 0} {$i < 10} {incr i 1} {puts "In the for loop, and i == $i"}


Enter tclsh test. tcl in the command line to execute













 

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.