1history(n)                   Tcl Built-In Commands                  history(n)
2
3
4
5______________________________________________________________________________
6

NAME

8       history - Manipulate the history list
9

SYNOPSIS

11       history ?option? ?arg arg ...?
12_________________________________________________________________
13
14

DESCRIPTION

16       The  history  command  performs  one  of  several operations related to
17       recently-executed commands recorded in a history list.  Each  of  these
18       recorded  commands  is referred to as an ``event''.  When specifying an
19       event to the history command, the following forms may be used:
20
21       [1]    A number:  if positive, it refers to the event with that  number
22              (all events are numbered starting at 1).  If the number is nega‐
23              tive, it selects an event relative  to  the  current  event  (-1
24              refers  to the previous event, -2 to the one before that, and so
25              on).  Event 0 refers to the current event.
26
27       [2]    A string:  selects  the  most  recent  event  that  matches  the
28              string.   An  event  is considered to match the string either if
29              the string is the same as the first characters of the event,  or
30              if the string matches the event in the sense of the string match
31              command.
32
33       The history command can take any of the following forms:
34
35       history
36              Same as history info, described below.
37
38       history add command ?exec?
39              Adds the command argument to the history list as  a  new  event.
40              If  exec  is specified (or abbreviated) then the command is also
41              executed and its result is returned.  If  exec  isn't  specified
42              then an empty string is returned as result.
43
44       history change newValue ?event?
45              Replaces  the  value recorded for an event with newValue.  Event
46              specifies the event to replace,  and  defaults  to  the  current
47              event  (not event -1).  This command is intended for use in com‐
48              mands that implement new forms of history substitution and  wish
49              to  replace  the  current event (which invokes the substitution)
50              with the command created through substitution.  The return value
51              is an empty string.
52
53       history clear
54              Erase  the  history  list.   The current keep limit is retained.
55              The history event numbers are reset.
56
57       history event ?event?
58              Returns the value of the event given by event.   Event  defaults
59              to -1.
60
61       history info ?count?
62              Returns  a formatted string (intended for humans to read) giving
63              the event number and contents for each of the events in the his‐
64              tory  list except the current event.  If count is specified then
65              only the most recent count events are returned.
66
67       history keep ?count?
68              This command may be used to change the size of the history  list
69              to  count events.  Initially, 20 events are retained in the his‐
70              tory list.  If count is not specified, the current keep limit is
71              returned.
72
73       history nextid
74              Returns  the number of the next event to be recorded in the his‐
75              tory list.  It is useful for things like printing the event num‐
76              ber in command-line prompts.
77
78       history redo ?event?
79              Re-executes  the  command  indicated  by  event  and returns its
80              result.  Event defaults to -1.  This command results in  history
81              revision:  see below for details.
82

HISTORY REVISION

84       Pre-8.0  Tcl  had  a  complex  history revision mechanism.  The current
85       mechanism is more limited, and the old  history  operations  substitute
86       and  words  have  been removed.  (As a consolation, the clear operation
87       was added.)
88
89       The history option redo results in much simpler  ``history  revision''.
90       When  this  option is invoked then the most recent event is modified to
91       eliminate the history command and replace it with  the  result  of  the
92       history  command.   If you want to redo an event without modifying his‐
93       tory, then use the event operation to retrieve some event, and the  add
94       operation to add it to history and execute it.
95
96

KEYWORDS

98       event, history, record
99
100
101
102Tcl                                                                 history(n)
Impressum