Tcl Programming: Print your name.

p14.tcl

#!/bin/tclsh            //It is advisable to mention which shell you using

puts "Hello Raj!"
puts Raj
set a 10                 //initialize variable "a' with value 10
puts $a                  
puts "$a"

on Terminal
$ chmod 775 p14.tcl
$ tclsh p14.tcl
Hello Raj
Raj
10
10
  

2 Comments

  1. I think #!/bin/tclsh (at the begnning) is not needed at all. Script will run even without it . Please check once at your end.

    ReplyDelete
  2. Yes you are right its not mandatory, it is advisable to mention #!/bin/tclsh or #!/bin/sh or some other shell. This line tell the system that below mentioned code should me invoked as which shell because every shell has its own set of syntax.
    Sometimes conflict may occur due to which it is advisable.
    I should correct myself too.
    Thank you for visiting my blog and practicing.

    ReplyDelete
Previous Post Next Post