history(n)                   Tcl Built-In Commands                  history(n)



______________________________________________________________________________

NNAAMMEE
       history - Manipulate the history list

SSYYNNOOPPSSIISS
       hhiissttoorryy ?_o_p_t_i_o_n? ?_a_r_g _a_r_g _._._.?
_________________________________________________________________

DDEESSCCRRIIPPTTIIOONN
       The hhiissttoorryy command performs one of several operations related to
       recently-executed commands recorded in a history list.  Each of these
       recorded commands is referred to as an "event".  When specifying an
       event to the hhiissttoorryy command, the following forms may be used:

       [1]    A number:  if positive, it refers to the event with that number
              (all events are numbered starting at 1).  If the number is
              negative, it selects an event relative to the current event (--11
              refers to the previous event, --22 to the one before that, and so
              on).  Event 00 refers to the current event.

       [2]    A string:  selects the most recent event that matches the
              string.  An event is considered to match the string either if
              the string is the same as the first characters of the event, or
              if the string matches the event in the sense of the ssttrriinngg mmaattcchh
              command.

       The hhiissttoorryy command can take any of the following forms:

       hhiissttoorryy
              Same as hhiissttoorryy iinnffoo, described below.

       hhiissttoorryy aadddd _c_o_m_m_a_n_d ?eexxeecc?
              Adds the _c_o_m_m_a_n_d argument to the history list as a new event.
              If eexxeecc is specified (or abbreviated) then the command is also
              executed and its result is returned.  If eexxeecc is not specified
              then an empty string is returned as result.

       hhiissttoorryy cchhaannggee _n_e_w_V_a_l_u_e ?_e_v_e_n_t?
              Replaces the value recorded for an event with _n_e_w_V_a_l_u_e.  _E_v_e_n_t
              specifies the event to replace, and defaults to the _c_u_r_r_e_n_t
              event (not event --11).  This command is intended for use in
              commands that implement new forms of history substitution and
              wish to replace the current event (which invokes the
              substitution) with the command created through substitution.
              The return value is an empty string.

       hhiissttoorryy cclleeaarr
              Erase the history list.  The current keep limit is retained.
              The history event numbers are reset.

       hhiissttoorryy eevveenntt ?_e_v_e_n_t?
              Returns the value of the event given by _e_v_e_n_t.  _E_v_e_n_t defaults
              to --11.

       hhiissttoorryy iinnffoo ?_c_o_u_n_t?
              Returns a formatted string (intended for humans to read) giving
              the event number and contents for each of the events in the
              history list except the current event.  If _c_o_u_n_t is specified
              then only the most recent _c_o_u_n_t events are returned.

       hhiissttoorryy kkeeeepp ?_c_o_u_n_t?
              This command may be used to change the size of the history list
              to _c_o_u_n_t events.  Initially, 20 events are retained in the
              history list.  If _c_o_u_n_t is not specified, the current keep limit
              is returned.

       hhiissttoorryy nneexxttiidd
              Returns the number of the next event to be recorded in the
              history list.  It is useful for things like printing the event
              number in command-line prompts.

       hhiissttoorryy rreeddoo ?_e_v_e_n_t?
              Re-executes the command indicated by _e_v_e_n_t and returns its
              result.  _E_v_e_n_t defaults to --11.  This command results in history
              revision:  see below for details.

HHIISSTTOORRYY RREEVVIISSIIOONN
       Pre-8.0 Tcl had a complex history revision mechanism.  The current
       mechanism is more limited, and the old history operations ssuubbssttiittuuttee
       and wwoorrddss have been removed.  (As a consolation, the cclleeaarr operation
       was added.)

       The history option rreeddoo results in much simpler "history revision".
       When this option is invoked then the most recent event is modified to
       eliminate the history command and replace it with the result of the
       history command.  If you want to redo an event without modifying
       history, then use the eevveenntt operation to retrieve some event, and the
       aadddd operation to add it to history and execute it.

KKEEYYWWOORRDDSS
       event, history, record



Tcl                                                                 history(n)
