history(3tcl)
π NAME π
history β the girl who manipulates the history list β¨
Okay bestie, so this whole page is about history, the Tcl built-in command that messes with (affectionate) your history list. Manipulate the history list, that's the vibe. Periodt.
β¨ SYNOPSIS β¨
history ?option? ?arg arg ...?
π DESCRIPTION π
The history command does one of several operations related to recently-executed commands recorded in a history list. Every one of those recorded commands is called an βeventβ. It's giving diary but for shell commands, honestly.
When you're specifying an event to the history command, you've got these forms to choose from:
- A number β if it's positive, it refers to the event with that number (all events are numbered starting at 1, no zero-indexing nonsense here π
). If the number is negative, it selects an event relative to the current event (
-1refers to the previous event,-2to the one before that, and so on). And0? That's the current event, bestie. - A string β selects the most recent event that matches the string. An event counts as matching 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
string matchcommand. Two ways to match, so generous of it fr fr.
The history command can take any of the following forms:
historyβ same ashistory info, described below. Short and sweet, we love a low-effort icon.history addcommand ?exec? β adds the command argument to the history list as a new event. If exec is specified (or abbreviated), then the command is also executed and its result is returned. If exec is not specified, then an empty string is returned as the result. Abbreviate away, queen.history changenewValue ?event? β replaces the value recorded for an event with newValue. event specifies the event to replace, and it defaults to the current event (not event-1, mind you β the current one). 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. π«Άhistory clearβ erase the history list. The current keep limit is retained. The history event numbers are reset. Total reset energy, we're starting fresh bestie.history event?event? β returns the value of the event given by event. event defaults to-1.history info?count? β returns a formatted string (intended for humans to read, so it's cute and legible π) giving the event number and contents for each of the events in the history list except the current event. If count is specified then only the most recent count events are returned.history keep?count? β this command may be used to change the size of the history list to count events. Initially,20events are retained in the history list. If count is not specified, the current keep limit is returned. Twenty. That's the default. Remember it.history nextidβ 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. βhistory redo?event? β re-executes the command indicated by event and returns its result. event defaults to-1. This command results in history revision: see below for details. π
π¦ HISTORY REVISION π¦
So, tea time. Pre-8.0 Tcl had a complex history revision mechanism. The current mechanism is more limited, and the old history operations substitute and words have been removed. (As a consolation, the clear operation was added. π We take those.)
The history option redo 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 theeventoperation to retrieve some event, and theaddoperation to add it to history and execute it. No cap, that's the clean way. π§
π KEYWORDS π
event, history, record
And that's the whole page, bestie β you ate it. π β¨
This one's from the Tcl Built-In Commands manual set, history(3tcl), brought to you by Tcl β mwah, thanks for reading, go redo some events responsibly ππ
π¦ where this page comes from
- debian trixie: tcl9.0-doc 9.0.1+dfsg-2
- ubuntu questing: tcl9.0-doc 9.0.2+dfsg-1
- ubuntu resolute: tcl9.0-doc 9.0.3+dfsg-1
- ubuntu stonking: tcl9.0-doc 9.0.4+dfsg-1
- Copyright (c) 1993 The Regents of the University of California
- Copyright (c) 1994-1997 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms