1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
<html lang="en">
<head>
<title>Command Line Options - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Invoking-Octave-from-the-Command-Line.html#Invoking-Octave-from-the-Command-Line" title="Invoking Octave from the Command Line">
<link rel="next" href="Startup-Files.html#Startup-Files" title="Startup Files">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Command-Line-Options"></a>
Next: <a rel="next" accesskey="n" href="Startup-Files.html#Startup-Files">Startup Files</a>,
Up: <a rel="up" accesskey="u" href="Invoking-Octave-from-the-Command-Line.html#Invoking-Octave-from-the-Command-Line">Invoking Octave from the Command Line</a>
<hr>
</div>
<h4 class="subsection">2.1.1 Command Line Options</h4>
<p><a name="index-Octave-command-options-27"></a><a name="index-command-options-28"></a><a name="index-options_002c-Octave-command-29"></a>
Here is a complete list of the command line options that Octave
accepts.
<dl>
<dt><code>--debug</code><dt><code>-d</code><dd><a name="index-g_t_0040code_007b_002d_002ddebug_007d-30"></a><a name="index-g_t_0040code_007b_002dd_007d-31"></a>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.
<br><dt><code>--doc-cache-file </code><var>filename</var><dd><a name="index-g_t_0040code_007b_002d_002ddoc_002dcache_002dfile-_0040var_007bfilename_007d_007d-32"></a>Specify the name of the doc cache file to use. The value of <var>filename</var>
specified on the command line will override any value of
<code>OCTAVE_DOC_CACHE_FILE</code><!-- /@w --> found in the environment, but not any commands
in the system or user startup files that use the <code>doc_cache_file</code>
function.
<br><dt><code>--echo-commands</code><dt><code>-x</code><dd><a name="index-g_t_0040code_007b_002d_002decho_002dcommands_007d-33"></a><a name="index-g_t_0040code_007b_002dx_007d-34"></a>Echo commands as they are executed.
<br><dt><code>--eval </code><var>code</var><dd>Evaluate <var>code</var> and exit when finished unless <code>--persist</code> is also
specified.
<br><dt><code>--exec-path </code><var>path</var><dd><a name="index-g_t_0040code_007b_002d_002dexec_002dpath-_0040var_007bpath_007d_007d-35"></a>Specify the path to search for programs to run. The value of <var>path</var>
specified on the command line will override any value of
<code>OCTAVE_EXEC_PATH</code><!-- /@w --> found in the environment, but not any commands
in the system or user startup files that set the built-in variable
<code>EXEC_PATH</code><!-- /@w -->.
<br><dt><code>--help</code><dt><code>-h</code><dt><code>-?</code><dd><a name="index-g_t_0040code_007b_002d_002dhelp_007d-36"></a><a name="index-g_t_0040code_007b_002dh_007d-37"></a><a name="index-g_t_0040code_007b_002d_003f_007d-38"></a>Print short help message and exit.
<br><dt><code>--image-path </code><var>path</var><dd><a name="index-g_t_0040code_007b_002d_002dimage_002dpath-_0040var_007bpath_007d_007d-39"></a>Add path to the head of the search path for images. The value of
<var>path</var> specified on the command line will override any value of
<code>OCTAVE_IMAGE_PATH</code><!-- /@w --> found in the environment, but not any commands
in the system or user startup files that set the built-in variable
<code>IMAGE_PATH</code><!-- /@w -->.
<br><dt><code>--info-file </code><var>filename</var><dd><a name="index-g_t_0040code_007b_002d_002dinfo_002dfile-_0040var_007bfilename_007d_007d-40"></a>Specify the name of the info file to use. The value of <var>filename</var>
specified on the command line will override any value of
<code>OCTAVE_INFO_FILE</code><!-- /@w --> found in the environment, but not any commands
in the system or user startup files that use the <code>info_file</code>
function.
<br><dt><code>--info-program </code><var>program</var><dd><a name="index-g_t_0040code_007b_002d_002dinfo_002dprogram-_0040var_007bprogram_007d_007d-41"></a>Specify the name of the info program to use. The value of <var>program</var>
specified on the command line will override any value of
<code>OCTAVE_INFO_PROGRAM</code><!-- /@w --> found in the environment, but not any
commands in the system or user startup files that use the
<code>info_program</code> function.
<br><dt><code>--interactive</code><dt><code>-i</code><dd><a name="index-g_t_0040code_007b_002d_002dinteractive_007d-42"></a><a name="index-g_t_0040code_007b_002di_007d-43"></a>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 <a href="Emacs-Octave-Support.html#Emacs-Octave-Support">Emacs Octave Support</a>.
<br><dt><code>--line-editing</code><dd><a name="index-g_t_0040code_007b_002d_002dline_002dediting_007d-44"></a>Force readline use for command-line editing.
<br><dt><code>--no-history</code><dt><code>-H</code><dd><a name="index-g_t_0040code_007b_002d_002dno_002dhistory_007d-45"></a><a name="index-g_t_0040code_007b_002dH_007d-46"></a>Disable recording of command-line history.
<br><dt><code>--no-init-file</code><dd><a name="index-g_t_0040code_007b_002d_002dno_002dinit_002dfile_007d-47"></a>Don't read the initialization files <samp><span class="file">~/.octaverc</span></samp> and <samp><span class="file">.octaverc</span></samp>.
<br><dt><code>--no-init-path</code><dd><a name="index-g_t_0040code_007b_002d_002dno_002dinit_002dpath_007d-48"></a>Don't initialize the search path for function files to include default
locations.
<br><dt><code>--no-line-editing</code><dd><a name="index-g_t_0040code_007b_002d_002dno_002dline_002dediting_007d-49"></a>Disable command-line editing.
<br><dt><code>--no-site-file</code><dd><a name="index-g_t_0040code_007b_002d_002dno_002dsite_002dfile_007d-50"></a>Don't read the site-wide <samp><span class="file">octaverc</span></samp> initialization files.
<br><dt><code>--norc</code><dt><code>-f</code><dd><a name="index-g_t_0040code_007b_002d_002dnorc_007d-51"></a><a name="index-g_t_0040code_007b_002df_007d-52"></a>Don't read any of the system or user initialization files at startup.
This is equivalent to using both of the options <code>--no-init-file</code>
and <code>--no-site-file</code>.
<br><dt><code>--path </code><var>path</var><dt><code>-p </code><var>path</var><dd><a name="index-g_t_0040code_007b_002d_002dpath-_0040var_007bpath_007d_007d-53"></a><a name="index-g_t_0040code_007b_002dp-_0040var_007bpath_007d_007d-54"></a>Add path to the head of the search path for function files. The
value of <var>path</var> specified on the command line will override any value
of <code>OCTAVE_PATH</code><!-- /@w --> found 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.
<br><dt><code>--persist</code><dd><a name="index-g_t_0040code_007b_002d_002dpersist_007d-55"></a>Go to interactive mode after <code>--eval</code> or reading from a file
named on the command line.
<br><dt><code>--silent</code><dt><code>--quiet</code><dt><code>-q</code><dd><a name="index-g_t_0040code_007b_002d_002dsilent_007d-56"></a><a name="index-g_t_0040code_007b_002d_002dquiet_007d-57"></a><a name="index-g_t_0040code_007b_002dq_007d-58"></a>Don't print the usual greeting and version message at startup.
<br><dt><code>--traditional</code><dt><code>--braindead</code><dd><a name="index-g_t_0040code_007b_002d_002dtraditional_007d-59"></a><a name="index-g_t_0040code_007b_002d_002dbraindead_007d-60"></a>For compatibility with <span class="sc">matlab</span>, set initial values for
user preferences to the following values
<pre class="example"> PS1 = ">> "
PS2 = ""
beep_on_error = true
confirm_recursive_rmdir = false
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
</pre>
<p class="noindent">and disable the following warnings
<pre class="example"> Octave:fopen-file-in-path
Octave:function-name-clash
Octave:load-file-in-path
</pre>
<br><dt><code>--verbose</code><dt><code>-V</code><dd><a name="index-g_t_0040code_007b_002d_002dverbose_007d-61"></a><a name="index-g_t_0040code_007b_002dV_007d-62"></a>Turn on verbose output.
<br><dt><code>--version</code><dt><code>-v</code><dd><a name="index-g_t_0040code_007b_002d_002dversion_007d-63"></a><a name="index-g_t_0040code_007b_002dv_007d-64"></a>Print the program version number and exit.
<br><dt><var>file</var><dd>Execute commands from <var>file</var>. Exit when done unless
<code>--persist</code> is also specified.
</dl>
<p>Octave also includes several functions which return information
about the command line, including the number of arguments and all of the
options.
<!-- octave.cc -->
<p><a name="doc_002dargv"></a>
<div class="defun">
— Built-in Function: <b>argv</b> ()<var><a name="index-argv-65"></a></var><br>
<blockquote><p>Return the command line arguments passed to Octave. For example,
if you invoked Octave using the command
<pre class="example"> octave --no-line-editing --silent
</pre>
<p class="noindent"><code>argv</code> would return a cell array of strings with the elements
<code>--no-line-editing</code> and <code>--silent</code>.
<p>If you write an executable Octave script, <code>argv</code> will return the
list of arguments passed to the script. See <a href="Executable-Octave-Programs.html#Executable-Octave-Programs">Executable Octave Programs</a>,
for an example of how to create an executable Octave script.
</p></blockquote></div>
<!-- octave.cc -->
<p><a name="doc_002dprogram_005fname"></a>
<div class="defun">
— Built-in Function: <b>program_name</b> ()<var><a name="index-program_005fname-66"></a></var><br>
<blockquote><p>Return the last component of the value returned by
<code>program_invocation_name</code>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dprogram_005finvocation_005fname.html#doc_002dprogram_005finvocation_005fname">program_invocation_name</a>.
</p></blockquote></div>
<!-- octave.cc -->
<p><a name="doc_002dprogram_005finvocation_005fname"></a>
<div class="defun">
— Built-in Function: program_invocation_name <b>(</b>)<var><a name="index-g_t_0028-67"></a></var><br>
<blockquote><p>Return the name that was typed at the shell prompt to run Octave.
<p>If executing a script from the command line (e.g., <code>octave foo.m</code>)
or using an executable Octave script, the program name is set to the
name of the script. See <a href="Executable-Octave-Programs.html#Executable-Octave-Programs">Executable Octave Programs</a>, for an example of
how to create an executable Octave script.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dprogram_005fname.html#doc_002dprogram_005fname">program_name</a>.
</p></blockquote></div>
<p>Here is an example of using these functions to reproduce the command
line which invoked Octave.
<pre class="example"> printf ("%s", program_name ());
arg_list = argv ();
for i = 1:nargin
printf (" %s", arg_list{i});
endfor
printf ("\n");
</pre>
<p class="noindent">See <a href="Indexing-Cell-Arrays.html#Indexing-Cell-Arrays">Indexing Cell Arrays</a>, for an explanation of how to retrieve objects
from cell arrays, and <a href="Defining-Functions.html#Defining-Functions">Defining Functions</a>, for information about the
variable <code>nargin</code>.
</body></html>
|