Re: running tcl shell interactive with source



Is this on a windows box? If so try the following
1. Make a bat file for each of the scripts you'd like preloaded
when the user starts tclsh. The bat looks like:
cp myscriptfile.tcl "%HOMEPATH%\tclshrc.tcl"
tclsh
2. Make desktop shortcuts to the batch files.

This uses the fact that tclsh will source %HOMEPATH%\tclshrc.tcl
prior to providing the command prompt. On unix you can do a similar
thing but
but the script will copy myscriptfile.tcl to ~/.tclshrc

RF


On Apr 9, 7:28 am, esd.protec...@xxxxxxxxxxxxxx wrote:
Hi,

I would like to run a tcl shell interactively, but also want to
provide a file to 'source' on the command line.

The reason for asking is that I've a number of scripts that are used
interactively, that have various procedures in them. The procedures
are run by the user to test hardware. But I don't want the user to
type in 'source' followed by the name of a script in a shell - what I
want is a shortcut on the desktop that they click to bring up the
shell with the appropriate file already 'sourced'.

It doesn't look as if I can do this with tclsh, so I've tried tkcon
with command line:

-main "source my_tcl_file.tcl"

Which looked promising..... but unfortunately, although
my_tcl_file.tcl is indeed sourced in the shell (I know this because I
have a puts in the file), none of the procs and variables set in that
file are available by the time I get to use the prompt!!

Is there a way that I can acheive this? Or are there any other tcl
shells I can investigate?

Thx

.



Relevant Pages

  • Re: running tcl shell interactive with source
    ... Make a bat file for each of the scripts you'd like preloaded ... Make desktop shortcuts to the batch files. ... This uses the fact that tclsh will source %HOMEPATH%\tclshrc.tcl ...
    (comp.lang.tcl)
  • Re: [Long] about ksh93 (Was: Bourne Shell Programming on Windows)
    ... Are you saying that David Korn is an unitiated or ignorant ksh ... > You provided one obscure example that does not occur in scripts. ... > in every shell. ... that should be teached in every shell programming book. ...
    (comp.unix.shell)
  • Re: Add user in Unix from command Line
    ... what shell the script should be interpreted with. ... Do you have any concept how many linux scripts that are part of the ... of relying on bash extensions are negligible. ... Those scripts at least in the sco case were probably a conscious design ...
    (comp.unix.sco.misc)
  • Re: [Long] about ksh93 (Was: Bourne Shell Programming on Windows)
    ... Note that in src/cmd/ksh93/OBSOLETE in ksh93 source ... > But this is a shell feature, not a shell programming feature. ... Look at David Korn's himself ksh scripts on its home ...
    (comp.unix.shell)
  • Re: Secure issues on the usage of exec
    ... > the shell may actually be a posix shell. ... first you have to get a setuid ksh script running. ... Linux doesn't support setuid scripts. ...
    (comp.unix.shell)