| pick0 | Index Level | VI Quick Reference |
| Syntax |
tcl
tcl {tcl.command} tcl -boot |
| Category | Unix |
| Type | Unix Shell |
| Description |
allows execution of Pick TCL commands directly from a Unix shell.
It is installed as a Unix shell script during Pick installation. To function properly, the "tcl" command requires that the user set several shell environment variables appropriately: PICKVM is the Pick virtual machine name. If this is not set, then the default of "pick0" is assumed. PICKUSER is the Pick user name. If not set, the Pick user is assumed to be the same as the Unix user. PICKUPASS is the Pick user password. This need only be set if a user password is present. PICKMD is the Pick master dictionary. This must be set unless the user macro automatically logs into a dictionary. PICKMDPASS is the Pick master dictionary password. This need only be set if a master dictionary password is present. Several variants of the "tcl" command are available. The "tcl" command by itself will push a Pick TCL shell above the current Unix one. This is equivalent to the Unix "sh" command. Logging off of Pick will automatically return to Unix. Note that although no logon messages appear, the login prompt and user macro are executed without output. The master dictionary macro is executed normally. The "tcl {tcl.command}" form executes a single TCL command and returns to Unix. Remember that the Unix shell must parse the TCL command before sending it to Pick, and therefore, all special characters, including "(", must be escaped to avoid errors. Also note that the "tcl" command logs into and out of Pick on every execution. The "tcl -boot" form will attempt to boot the desired Pick virtual machine. When the boot is completed, Pick returns control to Unix rather than going to a Pick logon. This can be useful for shell scripts that are automatically run when the Unix machine is booted. |
| Options | -boot Boots the Pick machine. |
| See Also | |
| Example |
The following sequence of commands sets up the necessary environment variables, pushes a Pick TCL shell, executes a few TCL commands, and exits back to the Unix shell. Note that this example shows input and output, and that "bsh" or "ksh" is assumed to be the active Unix shell.
$ PICKUSER="dm"; export PICKUSER $ PICKMD="dm"; export PICKMD $ tcl :who 6 dm dm :time 08:14:12 01 Mar 1993 Monday :off $ The "tcl" command may be easily incorporated into Unix shell scripts. The following example is a shell script called "up" which invokes the Pick Update processor from a Unix shell: #Shell script to run Update processor exec tcl u $* This shell script should be typed into an editor like "vi" and saved into the Unix file system. Then it must have its permissions changed so that it is executable with a "chmod a+x up" command. Finally, it must be placed in a directory which is contained in all users' "$PATH" variables. The users may have to log off and log back in again in order to recognize the new command. To run the shell script, users can type something like: up bp date This will invoke the Update processor on the "date" program in the "bp" file. It may be filed, or even run (with the ctl-X R command). When finished, the Update processor will return back the Unix shell. The "tcl" command also gives the capability of transferring data from Pick to Unix via pipes. The following example places a partial listing of the Pick "bp" file into the Unix file "bp.list". tcl list bp sampling 5 \(hcnb | tr -d "\015" > bp.list There are several points to note about this statement. First, notice that the "(" command must be preceded by a back-slash because the Unix shell would otherwise interpret the "(" as a special character. Also notice that the output must first be piped into the "tr" command which strips off carriage returns. This is necessary because Pick outputs in "raw" mode. In the next example, various Unix shell capabilities are demonstrated. The first line puts the name of the first program in the "bp" file into the Unix shell variable "PROGRAM". Next, that variable is "export"ed so that sub-shells can access it. Finally, that first program in the "bp" file is copied into an item called "backup" and the results of the operation are stored in the Unix "log" file. PROGRAM=`tcl list bp sampling 1 \(hcnb | tr -d "\015"` export PROGRAM echo "backup\r" | tcl copy bp $PROGRAM \(o | tr -d "\015" > log If the "\r" is left off on the input pipe, the command will terminate and return to Unix without doing anything. A different mode is used if the actual commands are piped into the "tcl" program as in the following example. Note that this example shows input and output, and that "bsh" or "ksh" is assumed to be the active Unix shell. $ echo "select bp with a0 \"date]\"\rcompile bp\r" | tcl :select bp with a0 "date]" [404] 2 items selected out of 279 items. :compile bp date *************** ... [241] successful compile! 3 frames used. date.iconv ****** [241] Successful compile! 1 frame(s) used. : When commands are piped in as the only input to the "tcl" statment, Pick behaves exactly as if those commands were typed directly at the keyboard. All simulated input and all output, including prompts, are sent to standard-out. Also note that multiple commands may be passed to the "tcl" program using this mode and that select lists will be preserved between each of those commands provided they are executed within a single execution of the "tcl" program. |
| Warnings |
The monitor debugger is not available during boot if the Pick machine is booted with the "tcl" command.
Select lists are not preserved accross "tcl" executions. Since the user macro is re-executed at every "tcl" command, it is wise to keep such macros as short as possible for maximum performance. The use of the "a" option in the respective user definition (to enable accounting) may cause a noticeable delay when exiting a "tcl" session. |
| Compatibility | AP 6.1 |
| pick0 | Index Level | VI Quick Reference |