Juge <
jyrki.m...@gmail.com> wrote:
> Assuming I have a tcl program like
> #!/usr/local/bin/tclsh
> proc HelloWorld {
> puts "Hello World"
> }
> proc GoodbyeWorld {
> puts "Goodbye cruelWorld"
> }
Did you type the above, or copy/paste? Because both the proc
definitions above are invalid. You omitted the parameter that defines
the proc's arguments. You need at least a {} (or "") after the name of
the proc above for these to be valid.
> And I want to call separate procedures from linux command shell. Like
> ,/program.tcl HelloWorld I know it would work with switch and using
> args but is there a direct way?
Yes, you just need one more line, provided you fix your syntax errors
above (note, however, if you call a proc that does not exist you'll get
a standard Tcl command not found error message):
Add this as the last line of your script above:
[lindex $argv 0]
Also, the above does not pass any parameters from the command line to
your procs (although your procs presumably take none, so not passing
any is reasonable here).