history(n)
π history(n) β the Tcl command that remembers everything you did π
okay bestie, listen. this is the manual page for the Tcl built-in history command, and honestly? it's giving "that friend who remembers the exact thing you said three hours ago." it manipulates the history list, which is the little archive of recently-executed commands. periodt.
β¨ SYNOPSIS β¨
history ?option? ?arg arg ...?
π¦ DESCRIPTION π¦
so the history command does one of several operations related to recently-executed commands recorded in a history list. every single one of those recorded commands is called an βeventβ. lowkey a cute name ngl.
when you're specifying an event to the history command, you can use these forms:
- A number β if it's 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 (-1refers to the previous event,-2to the one before that, and so on). and0?0refers to the current event. main character energy honestly. - 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
string matchcommand.
the history command can take any of the following forms, and you're gonna be obsessed with at least one of them:
historyβ same ashistory info, described below. it's the default, it's chill.history addcommand ?exec? β adds the command argument to the history list as a new event. if exec is specified (or abbreviated, bestie, abbreviations count) then the command is also executed and its result is returned. if exec is not specified then an empty string is returned as result. slay.history changenewValue ?event? β replaces the value recorded for an event with newValue. event specifies the event to replace, and defaults to the current event (not event-1, okay, that's important, don't get it twisted). 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β erases the history list. the current keep limit is retained. the history event numbers are reset. it's giving factory reset but make it cute.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 like, for you and me π ) 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 one changes the size of the history list to count events. initially, 20 events are retained in the history list. if count is not specified, the current keep limit is returned.history nextidβ returns the number of the next event to be recorded in the history list. super useful for things like printing the event number in command-line prompts. iykyk.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 π
ngl, this part is a little lore-heavy, so sit down.
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 love a silver lining π)
the history option redo results in a 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 event operation to retrieve some event, and the add operation to add it to history and execute it.
bestie note: don't go looking forsubstituteandwords. they're gone. it's a whole thing. we've moved on. ποΈ
π KEYWORDS π
event, history, record
okay that's the whole page!! this one comes from the Tcl crew β Tcl Built-In Commands, history(n), and if you need the receipts, it's dated Tcl. go forth and remember everything, bestie. πβ¨π¦
π¦ where this page comes from
- alpine 3.23: tcl9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tcl9-doc 9.0.3-r2 Β· TCL
- fedora 43: tcl-doc 1:9.0.2-1.fc43 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- fedora 44: tcl-doc 1:9.0.2-1.fc44 Β· TCL AND GPL-3.0-or-later WITH Bison-exception-2.2 AND BSD-3-Clause
- nixos 26.05: tcl 9.0.3
- 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