Tcl Hello World Example: How To Write,

Compile and Execute Tcl Programon Linux OS

系统中编写、、编译和运行Tcl程序

程序??

实例::如何在Linux系统中编写

Tcl Hello World 实例

原文出处:点击这里

by Ramesh Natarajan on April 9, 2010 ShareThis

由Ramesh Natarajan于2010年4月9日分享

Question: I would like to understand the basics of how to write and execute

Tcl program on UNIX / Linux OS. Can you explain it with a simple example?

问题:我想理解如何在UNIX/Linux系统中编写和运行Tcl程序的基本知识,您能用一个简单的例子解释下吗?

Answer: In this article, let us review very quickly how to write a basic Hello

World Tcl program and execute tcl program on Linux or Unix OS.

回答:在本文中,让我们快速地复习如何在Linux或Unix操作系统中编写一个基础的Hello World Tcl程序并运行tcl程序。

1. Write a Hello World Tcl Program

1.编写一个Hello World Tcl 程序

Create the helloworld program using the Vim editor as shown below.

使用如下所示的Vim编辑器新建一个helloworld程序:

$ vim helloworld.tcl

#!/usr/bin/tclsh

# hello world sample program

puts "Hello, World !"

Note: Comment in Tcl starts with #.

提示:Tcl程序中以“#”开头的为注释。

2. Make sure Tcl interpreter is installed on your system

2.确保您的系统安装了Tcl解释器

Make sure Tcl interpreter is installed on your system as shown below.

使用如下命令来确保您的系统安装Tcl解释器:

$ whereis tclsh

tclsh: /usr/bin/tclsh /usr/bin/tclsh8.4 /usr/share/man/man1/tclsh.1.gz

Installing tcl interpreter

Logo

更多推荐