|Title:||Specification of Alternatives to .wishrc/.tclshrc|
|Version:||$Revision: 1.8 $|
R. Timothy Edwards <tim at stravinsky dot jhuapl dot edu>|
Don Porter <dgp at users dot sf dot net>
|Created:||Wednesday, 12 May 2004|
|Keywords:||Tcl, Tk, shell, interactive|
This TIP describes an extension of the command-line options to the "wish" and "tclsh" programs to allow the startup script to be redirected from the default ~/.wishrc (or ~/.tclshrc) to an alternative file.
It is possible to run an application from a terminal that starts up a GUI or other event-based process but that, after setting up the event callback procedures, drops back into the terminal to allow a dual-input interface. As written, the only way to execute a script and return to the interpreter prompt in the terminal is to put the script in the ".wishrc" or ".tclshrc" startup script. One has to bend over backwards to write an application that will make this happen without actually changing the user's startup scripts. The shell script must redefine environment variable $HOME to point to the place where the script is that needs to be run, and the script itself then must be named ".wishrc" or ".tclshrc", or must have a symbolic link of that name pointing to it. The $HOME environment variable must be copied to another variable name if the application needs to reference the original value.
All this can be avoided by simply having a shell command-line option "-startup filename" that allows the specification of a name other than ".wishrc" or ".tclshrc" in a directory path that is not necessarily the user's home directory, to be used as the startup script. This would not only be useful for the purpose outlined above, but also to simply bypass whatever commands are executed by the default startup script.
The command-line option for "wish" and "tclsh" would be extended to add the option -startup, for example:
wish -startup filename [other options]
You are seeking interactivity following the evaluation of a start-up script. Is that the whole point? If so, then an alternative solution is provided at Tcl Patch 955470.
This document has been placed in the public domain.
[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]TIP AutoGenerator - written by Donal K. Fellows