I have tried using both shells, but neither finds my scripts.
% foo232 one two three
couldn't execute "I:\Utilities\foo232.tcl": no such file or directory
% hello
couldn't execute "I:\Utilities\hello.tcl": no such file or directory
%
but they are both there and produce the expected output when executed from Windows.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Neil>I:
I:\>foo232 one two three
I:\>cd Utilities
I:\Utilities>dir
Volume in drive I is Data
Volume Serial Number is CC28-EED0
Directory of I:\Utilities
09/25/2009 16:57 .
09/25/2009 16:57 ..
05/08/2009 10:11 BAT
07/31/2009 16:43 C++
07/31/2009 16:43 C-Smile
07/31/2009 16:45 C-Talk
05/12/2009 13:47 Excel
09/25/2009 16:57 66 foo232.tcl <====***
09/07/2009 14:00 219 frstry.py
09/18/2009 13:10 104 hello.tcl <====***
09/10/2009 18:04 27 hlowrld1.tcl
09/13/2009 16:38 49 hlowrld2.tcl
08/17/2009 14:44 1,118 hwin1.py
08/19/2009 18:39 281 hwtk1.pyw
08/09/2009 12:01 PERL
08/07/2009 11:46 PowerShell
09/07/2009 14:34 PYTHON
05/06/2008 18:29 257,161 QRP1.QIF
04/21/2009 11:10 REXX
08/10/2009 13:55 5,292 rtmp-results.txt
08/09/2009 16:25 1,193 rtmp.pl
08/14/2009 11:24 1,289 rtmp.py
07/31/2009 17:01 936 rtmp.txt
08/10/2009 13:46 7,197 strings-results.txt
08/14/2009 10:08 5,781 strings.py
07/27/2009 11:51 9,945 strings.txt
09/25/2009 16:52 TclTk
05/03/2009 23:48 649 Toy00+.bat
08/09/2009 15:23 1,625 Toy01b.pl
05/06/2009 11:10 750 toy04+.py
05/06/2009 12:28 367 toy05+.rex
05/12/2009 13:41 TXT
05/07/2009 09:41 VBS
04/16/2009 21:10 36,864 wish.exe
20 File(s) 330,913 bytes
14 Dir(s) 28,576,845,824 bytes free
I:\Utilities>
tclsh is for executing TCL commands not TCL scripts.
The source command reads every line in the file as though it were a valid TCL command (which hopefully it is :)
% source foo232.tcl
I'm still having problems:
(bin) 1 % sorce foo232.tcl
invalid command name "sorce"
(bin) 2 % source foo232.tcl
couldn't read file "foo232.tcl": no such file or directory
(bin) 3 % source i:/utilities/foo232.tcl <====*** worked
(bin) 4 % source i:/utilities/foo232.tcl one two three
wrong # args: should be "source ?-encoding name? fileName"
(bin) 5 % source "i:/utilities/foo232.tcl one two three"
couldn't read file "i:/utilities/foo232.tcl one two three": no such file or directory
(bin) 6 %
Ok, this is pretty basic stuff. I am guessing you are not very familiar with shells or the command-line. I would definitely recommend getting hold of Practical Programming in Tcl and reading that before continuing, but also spending a bit of time with the linux shell is going to help.
(bin) 2 % source foo232.tcl
couldn't read file "foo232.tcl": no such file or directory
You have given a RELATIVE path to source, so it searches foo232.tcl in the current working directory. 'pwd' will Print Working Directory.
To get around this use a ABSOLUTE path as you did in the 3rd line. Or change the current working directory using 'cd' then use a relative path.
(bin) 4 % source i:/utilities/foo232.tcl one two three
wrong # args: should be "source ?-encoding name? fileName"
I am assuming you are trying to pass arguments to whatever is in your file. You can't use the source command for this. You need to run the script directly from the windows cmd prompt, e.g.
C:> i:/utilities/foo232.tcl one two three
and it needs to have information in the header to tell is how to find the Tclsh. This is Programming 101 so I won't go into details - definitely do some more reading or you are going to be getting stuck very often.
I have several books that I'm trying to read:
Tcl/Tk for Real Programmers
Practical Programming in Tcl and Tk
Tcl/Tk in a Nutshell
Graphical Applications with Tcl and Tk
My take away from this would seem to be that wish is pretty useless, I may as well use the Window's command prompt and be done with it.
Thank you for the pwd. Is there any way to set the working directory?