Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie: TCL error 1

Status
Not open for further replies.

Hopeful22

MIS
Dec 27, 2001
11
US
Hiya,

I'm just starting to learn and get familiar with TCL. I have a shell script that executes a tcl. However, I get an error in my error log.

file.tcl: proc: command not found
file.tcl: puts: command not found

Might anyone know what is causing this? I have a redhat linux machine. A friend of mine gave me the tcl8.0.3.gzip and I put it in /usr/local/tcltk. Any help is appreciated..thanks in advance! :)
 
proc and puts are Tcl commands.
Can you show the beginning of the script you used?

ulis
 
I'm not too sure exactly what you would like me to post. Basically, inside my shell script it calls file.tcl:

file.tcl >> file.log

My file.tcl file is where I have all the proc and puts command and is kinda large to display in its entirety.

Here's a first few entries in the file.tcl:

set ptplotWhite "1.0 1.0 1.0"
set ptplotLightGrey "0.9 0.9 0.9"
set ptplotDarkGrey "0.7 0.7 0.7"
set ptplotRed "1.0 0 0"
set ptplotPurple "1.0 0 0.8"
set ptplotOrange "1.0 0.8 0.0"
set ptplotBlack "0 0 0"
set ptplotBrown "0.7 0.5 0"

set htmlWhite "#ffffff"
set htmlLightGrey "#CFCFCF"
set htmlDarkGrey "#A0A0A0"
set htmlRed "#ff0000"
set htmlPurple "#ff00d0"
set htmlOrange "#ffc000"
set htmlBlack "#000000"
set htmlBrown "#753506"

# 6 possible linkTrafficStatus :
set ptplotColor(NORMAL) $ptplotWhite
set ptplotColor(LIGHT) $ptplotLightGrey
set ptplotColor(HEAVY) $ptplotDarkGrey
set ptplotColor(NULL) $ptplotPurple
set ptplotColor(DOWN) $ptplotRed
set ptplotColor(NOT_MONITORED) $ptplotOrange
set ptplotColor(ABANDONED) $ptplotBrown

set htmlColor(NORMAL) $htmlWhite
set htmlColor(LIGHT) $htmlLightGrey
set htmlColor(HEAVY) $htmlDarkGrey
set htmlColor(NULL) $htmlPurple
set htmlColor(DOWN) $htmlRed
set htmlColor(NOT_MONITORED) $htmlOrange
set htmlColor(ABANDONED) $htmlBrown

Thanks for your attention.
 
It looks to me like you didn't call the TCL script correctly from the shell. Inside the shell (UNIX or NT) the actual command is the tcl or tk shell (say, tcl83.exe, for example) and the script is an argument.
 
Either that or use the interpreter (nix) call for scripts:
#!/location of tclsh
as your first line in file.tcl.

Or use the kludge people seem to like:

#!/bin/sh
#starting script next line
exec tclsh $0 ${1+"$@"}



 
Here's a snippet of the beginning of the file.tcl.

#!/usr/local/tcltk/bin/tcl -f


proc printLog { logStr } {
set LOG_DATE "[ exec date +%H:%M:%S] [exec date +%d-%m-%Y ]"
puts stdout "crocohtm: $LOG_DATE $logStr"
}
 
Is "/usr/local/tcltk/bin/" really the location of the tcl shell? And is "tcl" really the app? For example, on my UNIX machine, the tcl shell is /usr/local/bin/tclsh8.0.

Also, I don't think the -f argument is needed for the Tcl shell, just Tk. Bob Rashkin
rrashkin@csc.com
 
Bong you're correct, as I change "/usr/loca/tcltk/bin" to different directory, the error message changes. Although I've change from "tcl" to "tclsh8.0" to "tcl8.0.3" I continue to get "crocohtmInit3.0.tcl: proc: command not found" & crocohtmInit3.0.tcl: puts: command not found.
Is there an issue with the ".tcl" extension on the executable "crocohtmInit3.0.tcl"?
 
I don't think so. Let me understand a little better:

The name of your script is "crocohtmInit3.0.tcl" ?
And I gather that you have made the first line of the script something like #!/usr/local/.../tcl...

The symptom seems to me to indicate that the shell is not executing Tcl (otherwise it would know what "proc" and "puts" mean). So I would make sure (with ls, hunting around the file system) where the Tcl application is installed. Like I said, if you just default the installation, it winds up in /usr/local/bin. Then you need to check the actual application filename (which will depend on the version number). Bob Rashkin
rrashkin@csc.com
 
Try type -p tclsh.(8.3, or whatever.
or just find / -name tclsh*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top