1. What extension should I use in the file name. Should it be .tcl or .tclsh
We currently use “.tcl” as our extentions for TCL scripts but it can be any extension or no extension at all, stricly your choice but best to be consistant.
2. What should the bang line be?
We use both previously posted methods.
We started out using
#!/usr/bin/ksh
# this line to escape the next line from the tcl interpreter
exec hcitcl “$0” “$@”
and now use this for newly written TCL stand-alone scripts
#!/usr/bin/env tcl
3. Do I need to include an additional package.
Most of our standalone TCL scripts don’t need a pacakge but here is an example of one that did and how the “pacakge require” command was invoked.
# Require oth_unzip_oldmsgs
if {$debug} {
set display_line “$module requiring package oth_unzip_oldmsgs…”
subroutines::display
}
set ret_cd [catch {set oth_unzip_oldmsgs_vers [package require oth_unzip_oldmsgs]} err]
if {$ret_cd} {
set display_line “$module Error >$err$oth_unzip_oldmsgs_vers< acquired."
subroutines::display
}
}
Since you knew enough to ask about pacakges I will assume you understand how to access and maintain packages.
4. When I test this can I just navigate to the directory and call the script. Or do I need to start the tcl interpreter and then call the script or do I need to start the tclsh interpreter.
If you put your TCL standalone script in a directory in your path and set the permission of it to be executable, you can type the name of the file from any directory at the command line prompt and it will run.
You will not need to launch the hcitcl interperter to run a stand alone TCL script.
Russ Ross
RussRoss318@gmail.com