| www.delorie.com/gnu/docs/octave/octave_35.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Octave normally keeps track of the commands you type so that you can
recall previous commands to edit or execute them again. When you exit
Octave, the most recent commands you have typed, up to the number
specified by the variable history_size, are saved in a file.
When Octave starts, it loads an initial list of commands from the file
named by the variable history_file.
Here are the commands for simple browsing and searching the history list.
On most terminals, you can also use the arrow keys in place of C-p and C-n to move through the history list.
In addition to the keyboard commands for moving through the history list, Octave provides three functions for viewing, editing, and re-running chunks of commands from the history list.
history displays a list of commands
that you have executed. Valid options are:
-w file
-r file
N
-q
For example, to display the five most recent commands that you have typed without displaying line numbers, use the command history -q 5.
edit_history allows you to edit the
history list using the editor named by the variable EDITOR. The
commands to be edited are first copied to a temporary file. When you
exit the editor, Octave executes the commands that remain in the file.
It is often more convenient to use edit_history to define functions
rather than attempting to enter them directly on the command line.
By default, the block of commands is executed as soon as you exit the
editor. To avoid executing any commands, simply delete all the lines
from the buffer before exiting the editor.
The edit_history command takes two optional arguments specifying
the history numbers of first and last commands to edit. For example,
the command
edit_history 13 |
extracts all the commands from the 13th through the last in the history list. The command
edit_history 13 169 |
only extracts commands 13 through 169. Specifying a larger number for the first command than the last command reverses the list of commands before placing them in the buffer to be edited. If both arguments are omitted, the previous command in the history list is used.
edit_history, except that the editor is not invoked,
and the commands are simply executed as they appear in the history list.
edit_history command.
If the environment variable EDITOR is set when Octave starts, its
value is used as the default. Otherwise, EDITOR is set to
"emacs".
"~/.octave_hist", but may be
overridden by the environment variable OCTAVE_HISTFILE.
1024, but may be overridden by the
environment variable OCTAVE_HISTSIZE.
saving_history is nonzero, command entered
on the command line are saved in the file specified by the variable
history_file.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |