Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Simple Tcl on Solaris

Posted on 2012-03-23
Medium Priority
Last Modified: 2012-04-04
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.
Question by:gdspeare
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Accepted Solution

torakeshb earned 1500 total points
ID: 37757399
Here is the corrected code.

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

Author Comment

ID: 37758130
my tcl shell isn't in the the directory /usr/bin/tcl and some of the libraries it calls certainly are not.

Expert Comment

ID: 37758145
give the command "which tcl" will show the location of your tcl. You can change the location as per your system configuration.

Author Comment

ID: 37758315
Not familiar with this command.

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

/usr/bin/command[s]: which tcl: not found

Expert Comment

ID: 37758546
do you tcl installed? if you know the location of tcl then point to the tcl binary.

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
FreeBSD on EC2 FreeBSD ( is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question