Solved

Simple Tcl on Solaris

Posted on 2012-03-23
5
367 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now