Solved

Simple Tcl on Solaris

Posted on 2012-03-23
5
373 Views
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.
0
Comment
Question by:gdspeare
  • 3
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
torakeshb earned 500 total points
ID: 37757399
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
 

Author Comment

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

Expert Comment

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

Author Comment

by:gdspeare
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
0
 
LVL 6

Expert Comment

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

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
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 video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

808 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