The history
variable saves and prints the current command and history list number
to the screen. The history list keeps a record of the exact command
lines that you enter, in the order that you enter them. Unlike the
Korn shell, the C shell does not automatically have the history
variable set. You must set the history variable (history list) before
the history
command can be executed. You can set history
to a specific number to display
that number of previous commands to the screen.
| Command Format: |
| set
history=n |
Activating the history
Variable
In the first example in Figure ,
the last five command lines are displayed from the history list after
setting history to 5 then typing the history
command. After you have set the history variable, the history list
will then be created from that point on. Any commands entered before
executing the set history
command are not part of the history list. Any commands typed after
setting the history variable are added to the history list, as shown
in the second example, and are displayed each time you type the history
command. To stop
capturing history use the unset
history command.
|