Tool command language, a widely used scripting tool that was deveoped for controlling and extending appliations.
1 Run
When you have installed Tcl, the program you will then call to utilize it is tclsh
.
For instance, if you write some code to a file "hello.tcl", and you want to execute it, you would do it like so: tclsh hello.tcl
2 UNIX Tcl scripts (type "tclsh")
1) puts - writes the string to I/O steam
1 puts "Hello, World - In quotes" ; # This is a comment after the command. 2 puts {Hello, World - In Braces} 3 puts {Bad comment syntax example} # *Error* - there is no semicolon 4 5 puts "line 1"; puts "line 2" 6 7 puts "Hello, World; - With a semicolon inside the quotes" 8 9 # Words don't need to be quoted unless they contain white space: 10 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"