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
to display all available options and briefly describe their use (`octave -h' is a shorter equivalent).
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"
octave --no-line-editing --silent
argv would be a string vector with the elements
program_invocation_nameis automatically set to the name that was typed at the shell prompt to run Octave, and the value of
program_nameis automatically set to the final component of
program_invocation_name. For example, if you typed `/usr/local/bin/octave' to start Octave,
program_invocation_namewould have the value `/usr/local/bin/octave', and
program_namewould have the value
If executing a script from the command line (e.g.,
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_HOMEis 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_HOMEis the directory in which all of Octave is installed (the default is `/usr/local'), and
VERSIONis 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.
cdcommand 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
Startup files may contain any valid Octave commands, including multiple function definitions.
Go to the first, previous, next, last section, table of contents.