2.1.1 Command Line Options
Here is a complete list of all the command line options that Octave accepts.
--debug-d- Enter parser debugging mode. Using this option will cause Octave's parser to print a lot of information about the commands it reads, and is probably only useful if you are actually trying to debug the parser.
--echo-commands-x- Echo commands as they are executed.
--evalcode- Evaluate code and exit when done unless
--persistis also specified. --exec-pathpath- Specify the path to search for programs to run. The value of path specified on the command line will override any value of
OCTAVE_EXEC_PATHfound in the environment, but not any commands in the system or user startup files that set the built-in variableEXEC_PATH. --help-h-?- Print short help message and exit.
--image-pathpath- Specify the path to search for images. The value of path specified on the command line will set the value of
IMAGE_PATHfound in the environment. --info-filefilename- Specify the name of the info file to use. The value of filename specified on the command line will override any value of
OCTAVE_INFO_FILEfound in the environment, but not any commands in the system or user startup files that use theinfo_filefunction. --info-programprogram- Specify the name of the info program to use. The value of program specified on the command line will override any value of
OCTAVE_INFO_PROGRAMfound in the environment, but not any commands in the system or user startup files that use theinfo_programfunction. --interactive-i- Force interactive behavior. This can be useful for running Octave via a remote shell command or inside an Emacs shell buffer. For another way to run Octave within Emacs, see Emacs.
--no-history-H- Disable command-line history.
--no-init-file- Don't read the ~/.octaverc or .octaverc files.
--no-line-editing- Disable command-line editing.
--no-site-file- Don't read the site-wide octaverc file.
--norc-f- Don't read any of the system or user initialization files at startup. This is equivalent to using both of the options
--no-init-fileand--no-site-file. --pathpath-ppath- Specify the path to search for function files. The value of path specified on the command line will override any value of
OCTAVE_PATHfound in the environment, but not any commands in the system or user startup files that set the internal load path through one of the path functions. --persist- Go to interactive mode after
--evalor reading from a file named on the command line. --silent--quiet-q- Don't print the usual greeting and version message at startup.
--traditional--braindead- For compatibility with Matlab, set initial values for user-preferences to the following values
PS1 = ">> "
PS2 = ""
beep_on_error = true
crash_dumps_octave_core = false
default_save_options = "-mat-binary"
fixed_point_format = true
history_timestamp_format_string = "%%-- %D %I:%M %p --%%"
page_screen_output = false
print_empty_dimensions = false
and disable the following warnings
Octave:fopen-file-in-path
Octave:function-name-clash
Octave:load-file-in-path
--verbose-V- Turn on verbose output.
--version-v- Print the program version number and exit.
- file
- Execute commands from file. Exit when done unless
--persistis also specified.
Octave also includes several built-in variables that contain information about the command line, including the number of arguments and all of the options.
Return the command line arguments passed to Octave. For example, if you invoked Octave using the command
octave --no-line-editing --silent
argvwould return a cell array of strings with the elements--no-line-editingand--silent.If you write an executable Octave script,
argvwill return the list of arguments passed to the script. See Executable Octave Programs, for an example of how to create an executable Octave script.
Return the last component of of the value returned by
program_invocation_name.See also: program_invocation_name.
Return the name that was typed at the shell prompt to run 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.See also: program_name.
Here is an example of using these functions to reproduce Octave's command line.
printf ("%s", program_name ());
arg_list = argv ();
for i = 1:nargin
printf (" %s", arg_list{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.
No comments:
Post a Comment