TIP 199: Specification of Alternatives to .wishrc/.tclshrc

EuroTcl/OpenACS 11 - 12 JULY 2024, VIENNA
Author:         R. Timothy Edwards <[email protected]>
Author:         Don Porter <[email protected]>
State:          Rejected
Type:           Project
Vote:           Done
Created:        12-May-2004
Keywords:       Tcl,Tk,shell,interactive
Tcl-Version:    8.6


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.