Normally, Octave is used interactively by running the program `octave' without any arguments. Once started, Octave reads commands from the terminal until you tell it to exit.
You can also specify the name of a file on the command line, and Octave will read and execute the commands from the named file and then exit when it is finished.
You can further control how Octave starts up by using the command-line options described in the next section, and Octave itself can remind you of the options available. Type
octave --help
to display all available options and briefly describe their use (`octave -h' is a shorter equivalent).
--debug
-d
--echo-commands
-x
--exec-path path
--help
-h
-?
--info-file filename
--info-program program
--interactive
-i
--no-init-file
--no-line-editing
--no-site-file
--norc
-f
--no-init-file
and --no-site-file.
--path path
-p path
--silent
--quiet
-q
--traditional
--braindead
PS1 = ">> " PS2 = "" beep_on_error = 1 default_save_format = "mat-binary" define_all_return_values = 1 do_fortran_indexing = 1 empty_list_elements_ok = 1 implicit_str_to_num_ok = 1 ok_to_lose_imaginary_part = 1 page_screen_output = 0 prefer_column_vectors = 0 prefer_zero_one_indexing = 1 print_empty_dimensions = 0 treat_neg_dim_as_zero = 1 warn_function_name_clash = 0 whitespace_in_literal_matrix = "traditional"
--verbose
-V
--version
-v
file
octave --no-line-editing --silent
argv would be a string vector with the elements
--no-line-editing and --silent.
program_invocation_name is automatically set to the name that was
typed at the shell prompt to run Octave, and the value of
program_name is automatically set to the final component of
program_invocation_name. For example, if you typed
`/usr/local/bin/octave' to start Octave,
program_invocation_name would have the value
`/usr/local/bin/octave', and program_name would have
the value octave.
If executing a script from the command line (e.g., octave foo.m
or using an executable Octave script, the program name is set to the
name of the script. See section Executable Octave Programs for an example of
how to create an executable Octave script.
Here is an example of using these variables to reproduce Octave's command line.
printf ("%s", program_name);
for i = 1:nargin
printf (" %s", i, argv(i,:));
endfor
printf ("\n");
See section Index Expressions for an explanation of how to properly index arrays of strings and substrings in Octave.
When Octave starts, it looks for commands to execute from the following files:
OCTAVE_HOME/share/octave/site/m/startup/octaverc
OCTAVE_HOME is the directory in which all of Octave is
installed (the default is `/usr/local'). This file is provided so
that changes to the default Octave environment can be made globally for
all users at your site for all versions of Octave you have installed.
Some care should be taken when making changes to this file, since all
users of Octave at your site will be affected.
OCTAVE_HOME/share/octave/VERSION/m/startup/octaverc
OCTAVE_HOME is the directory in which all of Octave is
installed (the default is `/usr/local'), and VERSION is the
version number of Octave. This file is provided so that changes to the
default Octave environment can be made globally for all users for a
particular version of Octave. Some care should be taken when making
changes to this file, since all users of Octave at your site will be
affected.
~/.octaverc
.octaverc
cd
command in the `~/.octaverc' file will affect the directory that
Octave searches for the file `.octaverc'.
If you start Octave in your home directory, commands from from the file
`~/.octaverc' will only be executed once.
A message will be displayed as each of the startup files is read if you
invoke Octave with the --verbose option but without the
--silent option.
Startup files may contain any valid Octave commands, including multiple function definitions.
Go to the first, previous, next, last section, table of contents.