📄 history.n
字号:
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) history.n 1.11 97/08/07 16:44:49'\" .so man.macros.TH history n "" Tcl "Tcl Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEhistory \- Manipulate the history list.SH SYNOPSIS\fBhistory \fR?\fIoption\fR? ?\fIarg arg ...\fR?.BE.SH DESCRIPTION.PPThe \fBhistory\fR command performs one of several operations related torecently-executed commands recorded in a history list. Each ofthese recorded commands is referred to as an ``event''. Whenspecifying an event to the \fBhistory\fR command, the followingforms may be used:.IP [1]A number: if positive, it refers to the event withthat number (all events are numbered starting at 1). If the numberis negative, it selects an event relative to the current event(\fB\-1\fR refers to the previous event, \fB\-2\fR to the one before that, andso on). Event \fB0\fP refers to the current event..IP [2]A string: selects the most recent event that matches the string.An event is considered to match the string either if the string isthe same as the first characters of the event, or if the stringmatches the event in the sense of the \fBstring match\fR command..PPThe \fBhistory\fR command can take any of the following forms:.TP\fBhistory\fRSameas \fBhistory info\fR, described below..TP\fBhistory add\fI command \fR?\fBexec\fR?Adds the \fIcommand\fR argument to the history list as a new event. If\fBexec\fR is specified (or abbreviated) then the command is alsoexecuted and its result is returned. If \fBexec\fR isn't specifiedthen an empty string is returned as result..TP\fBhistory change\fI newValue\fR ?\fIevent\fR?Replaces the value recorded for an event with \fInewValue\fR. \fIEvent\fRspecifies the event to replace, anddefaults to the \fIcurrent\fR event (not event \fB\-1\fR). This commandis intended for use in commands that implement new forms of historysubstitution and wish to replace the current event (which invokes thesubstitution) with the command created through substitution. The returnvalue is an empty string..TP\fBhistory clear\fRErase the history list. The current keep limit is retained.The history event numbers are reset..TP\fBhistory event\fR ?\fIevent\fR?Returns the value of the event given by \fIevent\fR. \fIEvent\fRdefaults to \fB\-1\fR..TP\fBhistory info \fR?\fIcount\fR?Returns a formatted string (intended for humans to read) givingthe event number and contents for each of the events in the historylist except the current event. If \fIcount\fR is specifiedthen only the most recent \fIcount\fR events are returned..TP\fBhistory keep \fR?\fIcount\fR?This command may be used to change the size of the history list to\fIcount\fR events. Initially, 20 events are retained in the historylist. If \fIcount\fR is not specified, the current keep limit is returned..TP\fBhistory nextid\fRReturns the number of the next event to be recordedin the history list. It is useful for things like printing theevent number in command-line prompts..TP\fBhistory redo \fR?\fIevent\fR?Re-executes the command indicated by \fIevent\fR and return its result.\fIEvent\fR defaults to \fB\-1\fR. This command results in historyrevision: see below for details..SH "HISTORY REVISION".PPPre-8.0 Tcl had a complex history revision mechanism.The current mechanism is more limited, and the oldhistory operations \fBsubstitute\fP and \fBwords\fP have been removed.(As a consolation, the \fBclear\fP operation was added.).PPThe history option \fBredo\fR results in much simpler ``history revision''.When this option is invoked then the most recent eventis modified to eliminate the history command and replace it withthe result of the history command.If you want to redo an event without modifying history, then usethe \fBevent\fP operation to retrieve some event,and the \fBadd\fP operation to add it to history and execute it..SH KEYWORDSevent, history, record
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -