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 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
|
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Command Line Options (GNU Octave (version 10.3.0))</title>
<meta name="description" content="Command Line Options (GNU Octave (version 10.3.0))">
<meta name="keywords" content="Command Line Options (GNU Octave (version 10.3.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Invoking-Octave-from-the-Command-Line.html" rel="up" title="Invoking Octave from the Command Line">
<link href="Startup-Files.html" rel="next" title="Startup Files">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">
</head>
<body lang="en">
<div class="subsection-level-extent" id="Command-Line-Options">
<div class="nav-panel">
<p>
Next: <a href="Startup-Files.html" accesskey="n" rel="next">Startup Files</a>, Up: <a href="Invoking-Octave-from-the-Command-Line.html" accesskey="u" rel="up">Invoking Octave from the Command Line</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Command-Line-Options-1"><span>2.1.1 Command Line Options<a class="copiable-link" href="#Command-Line-Options-1"> ¶</a></span></h4>
<a class="index-entry-id" id="index-Octave-command-options"></a>
<a class="index-entry-id" id="index-command-options"></a>
<a class="index-entry-id" id="index-options_002c-Octave-command"></a>
<p>Here is a complete list of the command line options that Octave
accepts.
</p>
<dl class="table">
<dt><a id="index--_002d_002dbuilt_002din_002ddocstrings_002dfile-filename"></a><span><code class="code">--built-in-docstrings-file <var class="var">filename</var></code><a class="copiable-link" href="#index--_002d_002dbuilt_002din_002ddocstrings_002dfile-filename"> ¶</a></span></dt>
<dd><p>Specify the name of the file containing documentation strings for the
built-in functions of Octave. This value is normally correct and should
only need to be specified in extraordinary situations.
</p>
</dd>
<dt><a id="index--_002d_002ddoc_002dcache_002dfile-filename"></a><span><code class="code">--doc-cache-file <var class="var">filename</var></code><a class="copiable-link" href="#index--_002d_002ddoc_002dcache_002dfile-filename"> ¶</a></span></dt>
<dd><p>Specify the name of the documentation cache file to use. The value of
<var class="var">filename</var> specified on the command line will override any value of
<code class="env">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 class="code">doc_cache_file</code>
function.
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002dx"></a>
<a id="index--_002d_002decho_002dcommands"></a><span><code class="code">--echo-commands</code><a class="copiable-link" href="#index--_002d_002decho_002dcommands"> ¶</a></span></dt>
<dt><code class="code">-x</code></dt>
<dd><p>Echo commands as they are executed.
</p>
</dd>
<dt><a id="index--_002d_002deval-code"></a><span><code class="code">--eval <var class="var">code</var></code><a class="copiable-link" href="#index--_002d_002deval-code"> ¶</a></span></dt>
<dt><code class="code">-e <var class="var">code</var></code></dt>
<dd><p>Evaluate <var class="var">code</var> and exit when finished unless <samp class="option">--persist</samp> is also
specified.
</p>
</dd>
<dt><a id="index--_002d_002dexec_002dpath-path"></a><span><code class="code">--exec-path <var class="var">path</var></code><a class="copiable-link" href="#index--_002d_002dexec_002dpath-path"> ¶</a></span></dt>
<dd><p>Specify the path to search for programs to run. The value of <var class="var">path</var>
specified on the command line will override any value of
<code class="env">OCTAVE_EXEC_PATH</code><!-- /@w --> found in the environment, but not any commands
in the system or user startup files that call the
<code class="env">EXEC_PATH</code><!-- /@w --> function.
</p>
</dd>
<dt><a id="index--_002d_002dgui"></a><span><code class="code">--gui</code><a class="copiable-link" href="#index--_002d_002dgui"> ¶</a></span></dt>
<dt><code class="code">-g</code></dt>
<dd><p>Start the graphical user interface (GUI).
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002dh"></a>
<a id="index--_002d_002dhelp"></a><span><code class="code">--help</code><a class="copiable-link" href="#index--_002d_002dhelp"> ¶</a></span></dt>
<dt><code class="code">-h</code></dt>
<dd><p>Print short help message and exit.
</p>
</dd>
<dt><a id="index--_002d_002dimage_002dpath-path"></a><span><code class="code">--image-path <var class="var">path</var></code><a class="copiable-link" href="#index--_002d_002dimage_002dpath-path"> ¶</a></span></dt>
<dd><p>Add path to the head of the search path for images. The value of
<var class="var">path</var> specified on the command line will override any value of
<code class="env">OCTAVE_IMAGE_PATH</code><!-- /@w --> found in the environment, but not any commands
in the system or user startup files that call the
<code class="env">IMAGE_PATH</code><!-- /@w --> function.
</p>
</dd>
<dt><a id="index--_002d_002dinfo_002dfile-filename"></a><span><code class="code">--info-file <var class="var">filename</var></code><a class="copiable-link" href="#index--_002d_002dinfo_002dfile-filename"> ¶</a></span></dt>
<dd><p>Specify the name of the info file to use. The value of <var class="var">filename</var>
specified on the command line will override any value of
<code class="env">OCTAVE_INFO_FILE</code><!-- /@w --> found in the environment, but not any commands
in the system or user startup files that use the <code class="code">info_file</code>
function.
</p>
</dd>
<dt><a id="index--_002d_002dinfo_002dprogram-program"></a><span><code class="code">--info-program <var class="var">program</var></code><a class="copiable-link" href="#index--_002d_002dinfo_002dprogram-program"> ¶</a></span></dt>
<dd><p>Specify the name of the info program to use. The value of <var class="var">program</var>
specified on the command line will override any value of
<code class="env">OCTAVE_INFO_PROGRAM</code><!-- /@w --> found in the environment, but not any
commands in the system or user startup files that use the
<code class="code">info_program</code> function.
</p>
</dd>
<dt><a id="index--_002d_002dinit_002dtrace"></a><span><code class="code">--init-trace</code><a class="copiable-link" href="#index--_002d_002dinit_002dtrace"> ¶</a></span></dt>
<dd><p>Print the name of each configuration as it is read and executed during
initialization.
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002di"></a>
<a id="index--_002d_002dinteractive"></a><span><code class="code">--interactive</code><a class="copiable-link" href="#index--_002d_002dinteractive"> ¶</a></span></dt>
<dt><code class="code">-i</code></dt>
<dd><p>Force interactive behavior. This can be useful for running Octave via a
remote shell command or inside an Emacs shell buffer.
</p>
</dd>
<dt><a id="index--_002d_002dline_002dediting"></a><span><code class="code">--line-editing</code><a class="copiable-link" href="#index--_002d_002dline_002dediting"> ¶</a></span></dt>
<dd><p>Force readline use for command-line editing.
</p>
</dd>
<dt><a id="index--_002d_002dno_002dgui"></a><span><code class="code">--no-gui</code><a class="copiable-link" href="#index--_002d_002dno_002dgui"> ¶</a></span></dt>
<dt><code class="code">-G</code></dt>
<dd><p>Disable the graphical user interface (GUI) and use the command line
interface (CLI) instead. This is the default behavior, but this option
may be useful to override a previous <samp class="option">--gui</samp>.
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002dH"></a>
<a id="index--_002d_002dno_002dhistory"></a><span><code class="code">--no-history</code><a class="copiable-link" href="#index--_002d_002dno_002dhistory"> ¶</a></span></dt>
<dt><code class="code">-H</code></dt>
<dd><p>Disable recording of command-line history.
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002d_002dnorc"></a>
<a class="index-entry-id" id="index--_002df"></a>
<a id="index--_002d_002dno_002dinit_002dall"></a><span><code class="code">--no-init-all</code><a class="copiable-link" href="#index--_002d_002dno_002dinit_002dall"> ¶</a></span></dt>
<dt><code class="code">--norc</code></dt>
<dt><code class="code">-f</code></dt>
<dd><p>Don’t read any of the system or user initialization files at startup.
This is equivalent to using both of the options <samp class="option">--no-site-file</samp>
and <samp class="option">--no-init-user</samp>.
</p>
</dd>
<dt><a id="index--_002d_002dno_002dinit_002dpath"></a><span><code class="code">--no-init-path</code><a class="copiable-link" href="#index--_002d_002dno_002dinit_002dpath"> ¶</a></span></dt>
<dd><p>Don’t initialize the search path for function files to include default
locations.
</p>
</dd>
<dt><a class="index-entry-id" id="index-site-startup-file"></a>
<a id="index--_002d_002dno_002dinit_002dsite"></a><span><code class="code">--no-init-site</code><a class="copiable-link" href="#index--_002d_002dno_002dinit_002dsite"> ¶</a></span></dt>
<dd><p>Don’t read the site-wide <samp class="file">octaverc</samp> initialization files.
</p>
</dd>
<dt><a class="index-entry-id" id="index-_007e_002f_002eoctaverc"></a>
<a class="index-entry-id" id="index-_002eoctaverc"></a>
<a id="index--_002d_002dno_002dinit_002duser"></a><span><code class="code">--no-init-user</code><a class="copiable-link" href="#index--_002d_002dno_002dinit_002duser"> ¶</a></span></dt>
<dd><p>Don’t read the user initialization files <samp class="file">~/.octaverc</samp> and
<samp class="file">.octaverc</samp>.
</p>
</dd>
<dt><a id="index--_002d_002dno_002dline_002dediting"></a><span><code class="code">--no-line-editing</code><a class="copiable-link" href="#index--_002d_002dno_002dline_002dediting"> ¶</a></span></dt>
<dd><p>Disable command-line editing.
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002dW"></a>
<a id="index--_002d_002dno_002dwindow_002dsystem"></a><span><code class="code">--no-window-system</code><a class="copiable-link" href="#index--_002d_002dno_002dwindow_002dsystem"> ¶</a></span></dt>
<dt><code class="code">-W</code></dt>
<dd><p>Disable use of a windowing system including graphics. This forces a
strictly terminal-only environment.
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002dp-path"></a>
<a id="index--_002d_002dpath-path"></a><span><code class="code">--path <var class="var">path</var></code><a class="copiable-link" href="#index--_002d_002dpath-path"> ¶</a></span></dt>
<dt><code class="code">-p <var class="var">path</var></code></dt>
<dd><p>Add path to the head of the search path for function files. The
value of <var class="var">path</var> specified on the command line will override any value
of <code class="env">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.
</p>
</dd>
<dt><a id="index--_002d_002dpersist"></a><span><code class="code">--persist</code><a class="copiable-link" href="#index--_002d_002dpersist"> ¶</a></span></dt>
<dd><p>Go to interactive mode after <samp class="option">--eval</samp> or reading from a file
named on the command line.
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002d_002dsilent"></a>
<a class="index-entry-id" id="index--_002dq"></a>
<a id="index--_002d_002dquiet"></a><span><code class="code">--quiet</code><a class="copiable-link" href="#index--_002d_002dquiet"> ¶</a></span></dt>
<dt><code class="code">--silent</code></dt>
<dt><code class="code">-q</code></dt>
<dd><p>Don’t print the usual greeting and version message at startup.
</p>
</dd>
<dt><a id="index--_002d_002dtexi_002dmacros_002dfile-filename"></a><span><code class="code">--texi-macros-file <var class="var">filename</var></code><a class="copiable-link" href="#index--_002d_002dtexi_002dmacros_002dfile-filename"> ¶</a></span></dt>
<dd><p>Specify the name of the file containing Texinfo macros for use by makeinfo.
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002d_002dbraindead"></a>
<a id="index--_002d_002dtraditional"></a><span><code class="code">--traditional</code><a class="copiable-link" href="#index--_002d_002dtraditional"> ¶</a></span></dt>
<dt><code class="code">--braindead</code></dt>
<dd><p>For compatibility with <small class="sc">MATLAB</small>, set initial values for
user preferences to the following values
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">PS1 = ">> "
PS2 = ""
PS4 = ""
beep_on_error = true
confirm_recursive_rmdir = false
crash_dumps_octave_core = false
optimize_diagonal_matrix = false
optimize_permutation_matrix = false
optimize_range = false
fixed_point_format = true
history_timestamp_format_string = "%%-- %D %I:%M %p --%%"
print_empty_dimensions = false
print_struct_array_contents = true
save_default_options = "-mat-binary"
struct_levels_to_print = 0
</pre></div></div>
<p>and disable the following warnings
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">Octave:abbreviated-property-match
Octave:colon-nonscalar-argument
Octave:data-file-in-path
Octave:empty-index
Octave:function-name-clash
Octave:possible-matlab-short-circuit-operator
</pre></div></div>
<p>Note that this does not enable the <code class="code">Octave:language-extension</code>
warning, which you might want if you want to be told about writing code
that works in Octave but not <small class="sc">MATLAB</small> (see <a class="pxref" href="Issuing-Warnings.html#XREFwarning">warning</a>,
<a class="ref" href="Issuing-Warnings.html#XREFwarning_005fids">warning_ids</a>).
</p>
</dd>
<dt><a class="index-entry-id" id="index--_002dv"></a>
<a id="index--_002d_002dversion"></a><span><code class="code">--version</code><a class="copiable-link" href="#index--_002d_002dversion"> ¶</a></span></dt>
<dt><code class="code">-v</code></dt>
<dd><p>Print the program version number and exit.
</p>
</dd>
<dt><code class="code"><var class="var">file</var></code></dt>
<dd><p>Execute commands from <var class="var">file</var>. Exit when done unless <samp class="option">--persist</samp> is
also specified.
</p></dd>
</dl>
<p>Octave also includes several functions which return information about the
command line, including the number of arguments and all of the options.
</p>
<a class="anchor" id="XREFargv"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-argv"><span><code class="def-type"><var class="var">args</var> =</code> <strong class="def-name">argv</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-argv"> ¶</a></span></dt>
<dd><p>Return the command line arguments passed to Octave.
</p>
<p>For example, if you invoked Octave using the command
</p>
<div class="example">
<pre class="example-preformatted">octave --no-line-editing --quiet
</pre></div>
<p><code class="code">argv</code> would return a cell array of strings with the elements
<samp class="option">--no-line-editing</samp> and <samp class="option">--quiet</samp>.
</p>
<p>If you write an executable Octave script, <code class="code">argv</code> will return the list
of arguments passed to the script. See <a class="xref" href="Executable-Octave-Programs.html">Executable Octave Programs</a>, for
an example of how to create an executable Octave script.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFprogram_005fname">program_name</a>, <a class="ref" href="#XREFcmdline_005foptions">cmdline_options</a>.
</p></dd></dl>
<a class="anchor" id="XREFcmdline_005foptions"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-cmdline_005foptions"><span><code class="def-type"><var class="var">opt_struct</var> =</code> <strong class="def-name">cmdline_options</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-cmdline_005foptions"> ¶</a></span></dt>
<dd><p>Return a structure containing detailed information about the command line
arguments passed to Octave.
</p>
<p>Programming Note: This function provides copious amounts of information about
Octave’s parsing of command line options and may be more useful for debugging
Octave rather than for general use.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFargv">argv</a>, <a class="ref" href="#XREFprogram_005fname">program_name</a>.
</p></dd></dl>
<a class="anchor" id="XREFprogram_005fname"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-program_005fname"><span><code class="def-type"><var class="var">name</var> =</code> <strong class="def-name">program_name</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-program_005fname"> ¶</a></span></dt>
<dd><p>Return the filename component of the value returned by
<code class="code">program_invocation_name</code>.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFprogram_005finvocation_005fname">program_invocation_name</a>, <a class="ref" href="#XREFargv">argv</a>.
</p></dd></dl>
<a class="anchor" id="XREFprogram_005finvocation_005fname"></a><span style="display:block; margin-top:-4.5ex;"> </span>
<dl class="first-deftypefn">
<dt class="deftypefn" id="index-program_005finvocation_005fname"><span><code class="def-type"><var class="var">name</var> =</code> <strong class="def-name">program_invocation_name</strong> <code class="def-code-arguments">()</code><a class="copiable-link" href="#index-program_005finvocation_005fname"> ¶</a></span></dt>
<dd><p>Return the string that was typed at the shell prompt to run Octave.
</p>
<p>The string may include path components as well as the program filename.
</p>
<p>If executing a script from the command line (e.g., <code class="code">octave foo.m</code>) or
using an executable Octave script, the program name is set to the name of the
script. See <a class="xref" href="Executable-Octave-Programs.html">Executable Octave Programs</a>, for an example of how to create an
executable Octave script.
</p>
<p><strong class="strong">See also:</strong> <a class="ref" href="#XREFprogram_005fname">program_name</a>, <a class="ref" href="#XREFargv">argv</a>.
</p></dd></dl>
<p>Here is an example of using these functions to reproduce the command
line which invoked Octave.
</p>
<div class="example">
<div class="group"><pre class="example-preformatted">printf ("%s", program_name ());
arg_list = argv ();
for i = 1:nargin
printf (" %s", arg_list{i});
endfor
printf ("\n");
</pre></div></div>
<p>See <a class="xref" href="Indexing-Cell-Arrays.html">Indexing Cell Arrays</a>, for an explanation of how to retrieve objects
from cell arrays, and <a class="ref" href="Defining-Functions.html">Defining Functions</a>, for information about the
variable <code class="code">nargin</code>.
</p>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Startup-Files.html">Startup Files</a>, Up: <a href="Invoking-Octave-from-the-Command-Line.html">Invoking Octave from the Command Line</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|