Wish is a simple program consisting of the Tcl command language, the Tk toolkit, and a main program that reads commands from standard input or from a file. It creates a main window and then processes Tcl commands. If wish is invoked with no -f option then it reads Tcl commands interactively from standard input. It will continue processing commands until all windows have been deleted or until end-of-file is reached on standard input. If there exists a file .wishrc in the home directory of the user, wish evaluates the file as a Tcl script just before reading the first command from standard input.
If the -file option is provided to Tk, then wish reads Tcl commands from the file named in the -file option. These commands will normally create an interactive interface consisting of one or more widgets. When the end of the command file is reached, wish will continue to respond to X events until all windows have been deleted. There is no automatic evaluation of .wishrc in this case, but the script file can always source it if desired.
Wish sets the following Tcl variables:
If you create a Tcl script in a file whose first line is
#!/usr/local/bin/wish -fthen you can invoke the script file directly from your shell if you mark it as executable. This assumes that wish has been installed in the default location in /usr/local/bin; if it's installed somewhere else then you'll have to modify the above line to match.
When wish is invoked interactively it normally prompts for each command with ``% ''. You can change the prompt by setting the variables tcl_prompt1 and tcl_prompt2. If variable tcl_prompt1 exists then it must consist of a Tcl script to output a prompt; instead of outputting a prompt wish will evaluate the script in tcl_prompt1. The variable tcl_prompt2 is used in a similar way when a newline is typed but the current command isn't yet complete; if tcl_prompt2 isn't set then no prompt is output for incomplete commands.