Next: Startup Files, Up: Invoking Octave
Here is a complete list of all the command line options that Octave accepts.
--debug-d--echo-commands-x--exec-path pathOCTAVE_EXEC_PATH found in the environment, but not any commands
in the system or user startup files that set the built-in variable
EXEC_PATH.
--help-h-?--info-file filenameOCTAVE_INFO_FILE found in the environment, but not any commands
in the system or user startup files that set the built-in variable
INFO_FILE.
--info-program programOCTAVE_INFO_PROGRAM found in the environment, but not any
commands in the system or user startup files that set the built-in
variable INFO_PROGRAM.
--interactive-i--no-history-H--no-init-file--no-line-editing--no-site-file--norc-f--no-init-file
and --no-site-file.
--path path-p pathOCTAVE_PATH found in the environment, but not any commands in the
system or user startup files that set the built-in variable LOADPATH.
--silent--quiet-q--traditional--braindead PS1 = ">> "
PS2 = ""
beep_on_error = true
crash_dumps_octave_core = false
default_save_format = "mat-binary"
fixed_point_format = true
page_screen_output = false
print_empty_dimensions = false
warn_function_name_clash = false
--verbose-V--version-vOctave also includes several built-in variables that contain information about the command line, including the number of arguments and all of the options.
The command line arguments passed to Octave are available in this variable. For example, if you invoked Octave using the command
octave --no-line-editing --silent
argvwould be a cell array of strings with the elements--no-line-editingand--silent.If you write an executable Octave script,
argvwill contain the list of arguments passed to the script. See Executable Octave Programs, for an example of how to create an executable Octave script.
When Octave starts, the value of the built-in variable
program_invocation_nameis automatically set to the name that was typed at the shell prompt to run Octave, and the value ofprogram_nameis automatically set to the final component ofprogram_invocation_name. For example, if you typed `/usr/local/bin/octave' to start Octave,program_invocation_namewould have the value"/usr/local/bin/octave", andprogram_namewould 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 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", nth (argv, i));
endfor
printf ("\n");
See Index Expressions, for an explanation of how to properly index
arrays of strings and substrings in Octave, and See Defining Functions,
for information about the variable nargin.