Simple Tcl on Solaris

I have a pretty simple question.  I'm just trying to do a simple "hello world" example to get my brain moving.  

I'm trying to run (in a putty shell):

exec <myfile.tcl>

#!<tcl path here>

set outfile [open ["home/myid/myfile.txt w]
puts $outfile "here is my test"
puts "done"

however when i do, my putty window is closing down and my file is not being created.  I have verified that i have rwxrwxr-x permissions on the file (not getting a permissions conflict)

Pretty new to unix so thanks for the help.
gdspeareAsked:
Who is Participating?
 
torakeshbConnect With a Mentor Commented:
Here is the corrected code.

#!/usr/bin/tcl
set outfile [open "/home/rakesh/myfile.txt" w]
puts $outfile "here is my test"
puts "done"

save it as "myscript.tcl"
Then provide the execute privilege using the command "chmod 775 myscript.tcl"
Run the command using ./myscript.tcl
0
 
gdspeareAuthor Commented:
my tcl shell isn't in the the directory /usr/bin/tcl and some of the libraries it calls certainly are not.
0
 
torakeshbCommented:
give the command "which tcl" will show the location of your tcl. You can change the location as per your system configuration.
0
 
gdspeareAuthor Commented:
Not familiar with this command.

I tried unix command: command "which tcl" which resulted in

/usr/bin/command[s]: which tcl: not found
0
 
torakeshbCommented:
do you tcl installed? if you know the location of tcl then point to the tcl binary.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.