'''`[http://tcl.tk/man/tcl/TclCmd/history.htm%|%history]`''', a [Tcl commands%|%built-in] command, manipulates the history list. ** Synopsis ** : '''history''' ?''option''? ?''arg arg ...''? Supported subcommands are: : '''[history add]''' ''script'' ?'''exec'''? : '''[history change]''' ''newValue'' ?''event''? : '''[history clear]''' : '''[history event]''' ?''event''? : '''[history info]''' ?''count''? : '''[history keep]''' ?''count''? : '''[history nextid]''' : '''[history redo]''' ?''event''? ** Description ** '''`history`''', with no additional arguments, is equivalent to `[history info]`. ** Usage ** You could, of course, just use it as is, but at least parts of it are "intended for use in commands that implement new forms of history substitution" (as stated in the official documentation). There actually are such commands, implemented by the standard [unknown] (they are rather [csh]-like). ====== if {$name eq "!!"} { set newcmd [history event] } elseif {[regexp {^!(.+)$} $name -> event]} { set newcmd [history event $event] } elseif {[regexp {^\^([^^]*)\^([^^]*)\^?$} $name -> old new]} { set newcmd [history event -1] catch {regsub -all -- $old $newcmd $new newcmd} } if {[info exists newcmd]} { tclLog $newcmd history change $newcmd 0 uplevel 1 [list ::catch $newcmd ::tcl::UnknownResult ::tcl::UnknownOptions] dict incr ::tcl::UnknownOptions -level return -options $::tcl::UnknownOptions $::tcl::UnknownResult } ====== <> Tcl syntax help | Arts and crafts of Tcl-Tk programming | Command