Tcl之Intro

  Tool command language, a widely used scripting tool that was deveoped for controlling and extending appliations.

1  Syntax

command arg1 arg2 arg3 ...

 

2  UNIX Tcl scripts (type "tclsh")

   1) putswrites the string to I/O steam

 1 puts "Hello, World - In quotes"    ; # This is a comment after the command.

 2 # This is a comment at beginning of a line

 3 puts {Hello, World - In Braces}

 4 puts {Bad comment syntax example}   # *Error* - there is no semicolon!

 5 

 6 puts "line 1"; puts "line 2"

 7 

 8 puts "Hello, World; - With  a semicolon inside the quotes"

 9 

10 # Words don't need to be quoted unless they contain white space:

11 puts HelloWorld

 

   2) set - assign a value to a variable

  The dollar sign $ tells Tcl to use the value of the variable - in this case X or Y.

 1 set X "This is a string"

 2 

 3 set Y 1.24

 4 

 5 puts $X

 6 puts $Y

 7 

 8 puts "..............................."

 9 

10 set label "The value in Y is: "

11 puts "$label $Y"

 

你可能感兴趣的:(Tcl)