Commands entered at the terminal are stored in a command stack (to be technically correct, it a queue but historically users have called it a stack). They may subsequently be recalled for re-execution by a simple short form command. By default, the stack holds the last 99 commands but this value can be changed by use of the CMDSTACK configuration parameter. The list is indexed by number such that the most recent command is numbered as 1, the oldest as 99.
The stack can be manipulated by commands prefixed by a dot character entered at the command prompt. These allow commands on the stack to be edited and also provide facilities to save and restore sequences of commands to and from VOC paragraphs.
The stack manipulation commands are
.An text | Append text to command stack entry n. There must be a space before text. Any additional spaces will be included in the appended data. If n is omitted, the top entry on the stack (position 1) is updated. The text is displayed after modification. |
.Cn /old/new/G | Change string old to new in stack entry n. If n is omitted, it defaults to one. The delimiters around old and new may be any non-space character. The space before the first delimiter may be omitted if the delimiter is not a digit. The optional G causes a global replacement, that is, all occurrences of old are replaced by new. If G is not specified, only the first occurrence of old is changed. The text is displayed after modification. |
.Dn | Delete stack entry n. If n is omitted, the top stack entry is deleted. |
.D name | Delete VOC entry name if it is a sentence or paragraph record. A confirmation prompt is issued prior to deletion. |
.In text | Insert text as stack entry n. If n is not specified, text is inserted at the top of the stack. There must be a space before text. Any additional spaces will form part of the inserted entry. |
.Ln | List the most recent n commands. The value of n defaults to 20. |
.L name | List VOC entry name. |
.Rn | Recall stack entry n to the top of the stack without deleting the original copy. If n is omitted, the top entry is duplicated. |
.R name | Read VOC entry name to the top of the stack if it is a sentence or paragraph. Field one of the VOC entry is discarded and any continuation lines are merged. |
.S name n m | Save stack lines m to n as VOC entry name. The value of m and n may be entered in either order. If m is omitted it defaults to the same value as n. If n is also omitted, the top line of the stack is saved. The VOC entry will be a sentence if only a single line is saved, otherwise it will be a paragraph. |
.Un | Convert stack entry n to upper case. n defaults to one if omitted. |
.Xn | Execute command n. If n is omitted, the last command is executed. |
The repeated command is copied to the top of the stack except when executing the current topmost command.
.X file record | Execute command stored in the named file and record. This record must have the same format as a VOC record. |
.? | Display a help message regarding the stack manipulation commands. |
For compatibility with other environments, a command can also be saved on the stack without execution by entering it at the command prompt with a question mark as the last character. The question mark is removed.
The command stack is saved between sessions if the VOC contains a record named $COMMAND.STACK with field 1 set to X. This record is inserted automatically when a new account is created but can be deleted if the stack is not to be saved. For console users on Windows systems, the command stack will be saved into this record on leaving QM and loaded from it on re-entry. For all other Windows users and on other platforms, presence of this record causes the command stack to be saved to, or restored from, a file named as the user's login name in the stacks subdirectory of the account in which QM was entered.
See also The Command Editor
|