/usr/share/doc/zsh-common/html/Invocation.html is in zsh-doc 5.1.1-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.0, http://www.gnu.org/software/texinfo/ -->
<head>
<title>zsh: 4 Invocation</title>
<meta name="description" content="zsh: 4 Invocation">
<meta name="keywords" content="zsh: 4 Invocation">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="texi2any">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space: nowrap}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: serif; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Invocation"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="Roadmap.html#Roadmap" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="Roadmap.html#Programming" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation-2" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left">[<a href="Files.html#Files" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Invocation-1"></a>
<h1 class="chapter">4 Invocation</h1>
<a name="index-invocation"></a>
<hr>
<a name="Invocation-2"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Compatibility" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left">[<a href="Files.html#Files" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<h2 class="section">4.1 Invocation</h2>
<a name="index-shell-options"></a>
<a name="index-options_002c-shell"></a>
<a name="index-shell-flags"></a>
<a name="index-flags_002c-shell"></a>
<p>The following flags are interpreted by the shell when invoked to determine
where the shell will read commands from:
</p>
<dl compact="compact">
<dt><tt>-c</tt></dt>
<dd><p>Take the first argument as a command to execute, rather than reading commands
from a script or standard input. If any further arguments are given, the
first one is assigned to <tt>$0</tt>, rather than being used as a positional
parameter.
</p>
</dd>
<dt><tt>-i</tt></dt>
<dd><p>Force shell to be interactive. It is still possible to specify a
script to execute.
</p>
</dd>
<dt><tt>-s</tt></dt>
<dd><p>Force shell to read commands from the standard input.
If the <tt>-s</tt> flag is not present and an argument is given,
the first argument is taken to be the pathname of a script to
execute.
</p>
</dd>
</dl>
<p>If there are any remaining arguments after option processing, and neither
of the options <tt>-c</tt> or <tt>-s</tt> was supplied, the first argument is taken
as the file name of a script containing shell commands to be executed. If
the option <tt>PATH_SCRIPT</tt> is set, and the file name does not contain a
directory path (i.e. there is no ‘<tt>/</tt>’ in the name), first the current
directory and then the command path given by the variable <tt>PATH</tt> are
searched for the script. If the option is not set or the file name
contains a ‘<tt>/</tt>’ it is used directly.
</p>
<p>After the first one or two arguments have been appropriated as described above,
the remaining arguments are assigned to the positional parameters.
</p>
<p>For further options, which are common to invocation and the <tt>set</tt>
builtin, see
<a href="Options.html#Options">Options</a>.
</p>
<p>Options may be specified by name using the <tt>-o</tt> option. <tt>-o</tt> acts like
a single-letter option, but takes a following string as the option name.
For example,
</p>
<div class="example">
<pre class="example">zsh -x -o shwordsplit scr
</pre></div>
<p>runs the script <tt>scr</tt>, setting the <tt>XTRACE</tt> option by the corresponding
letter ‘<tt>-x</tt>’ and the <tt>SH_WORD_SPLIT</tt> option by name.
Options may be turned <em>off</em> by name by using <tt>+o</tt> instead of <tt>-o</tt>.
<tt>-o</tt> can be stacked up with preceding single-letter options, so for example
‘<tt>-xo shwordsplit</tt>’ or ‘<tt>-xoshwordsplit</tt>’ is equivalent to
‘<tt>-x -o shwordsplit</tt>’.
</p>
<a name="index-long-option"></a>
<p>Options may also be specified by name in GNU long option style,
‘<tt>-</tt><tt>-</tt><var>option-name</var>’. When this is done, ‘<tt>-</tt>’ characters in the
option name are permitted: they are translated into ‘<tt>_</tt>’, and thus ignored.
So, for example, ‘<tt>zsh -</tt><tt>-sh-word-split</tt>’ invokes zsh with the
<tt>SH_WORD_SPLIT</tt> option turned on. Like other option syntaxes, options can
be turned off by replacing the initial ‘<tt>-</tt>’ with a ‘<tt>+</tt>’; thus
‘<tt>+-sh-word-split</tt>’ is equivalent to ‘<tt>-</tt><tt>-no-sh-word-split</tt>’.
Unlike other option syntaxes, GNU-style long options cannot be stacked with
any other options, so for example ‘<tt>-x-shwordsplit</tt>’ is an error,
rather than being treated like ‘<tt>-x -</tt><tt>-shwordsplit</tt>’.
</p>
<a name="index-_002d_002dversion"></a>
<a name="index-_002d_002dhelp"></a>
<p>The special GNU-style option ‘<tt>-</tt><tt>-version</tt>’ is handled; it sends to
standard output the shell’s version information, then exits successfully.
‘<tt>-</tt><tt>-help</tt>’ is also handled; it sends to standard output a list of
options that can be used when invoking the shell, then exits successfully.
</p>
<p>Option processing may be finished, allowing following arguments that start with
‘<tt>-</tt>’ or ‘<tt>+</tt>’ to be treated as normal arguments, in two ways.
Firstly, a lone ‘<tt>-</tt>’ (or ‘<tt>+</tt>’) as an argument by itself ends
option processing. Secondly, a special option ‘<tt>-</tt><tt>-</tt>’ (or
‘<tt>+-</tt>’), which may be specified on its own (which is the standard
POSIX usage) or may be stacked with preceding options (so ‘<tt>-x-</tt>’ is
equivalent to ‘<tt>-x -</tt><tt>-</tt>’). Options are not permitted to be stacked
after ‘<tt>-</tt><tt>-</tt>’ (so ‘<tt>-x-f</tt>’ is an error), but note the GNU-style
option form discussed above, where ‘<tt>-</tt><tt>-shwordsplit</tt>’ is permitted
and does not end option processing.
</p>
<p>Except when the <cite>sh</cite>/<cite>ksh</cite> emulation single-letter options are in effect,
the option ‘<tt>-b</tt>’ (or ‘<tt>+b</tt>’) ends option processing.
‘<tt>-b</tt>’ is like ‘<tt>-</tt><tt>-</tt>’, except that further single-letter options
can be stacked after the ‘<tt>-b</tt>’ and will take effect as normal.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="#Compatibility">4.2 Compatibility</a></td><td> </td><td align="left" valign="top">
</td></tr>
<tr><td align="left" valign="top"><a href="#Restricted-Shell">4.3 Restricted Shell</a></td><td> </td><td align="left" valign="top">
</td></tr>
</table>
<hr>
<a name="Compatibility"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation-2" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="#Restricted-Shell" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left">[<a href="Files.html#Files" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Compatibility-1"></a>
<h2 class="section">4.2 Compatibility</h2>
<a name="index-compatibility"></a>
<a name="index-sh-compatibility"></a>
<a name="index-ksh-compatibility"></a>
<p>Zsh tries to emulate <cite>sh</cite> or <cite>ksh</cite> when it is invoked as
<tt>sh</tt> or <tt>ksh</tt> respectively; more precisely, it looks at the first
letter of the name by which it was invoked, excluding any initial ‘<tt>r</tt>’
(assumed to stand for ‘restricted’), and if that is ‘<tt>b</tt>’, ‘<tt>s</tt>’ or ‘<tt>k</tt>’ it
will emulate <cite>sh</cite> or <cite>ksh</cite>. Furthermore, if invoked as <tt>su</tt> (which
happens on certain systems when the shell is executed by the <tt>su</tt>
command), the shell will try to find an alternative name from the <tt>SHELL</tt>
environment variable and perform emulation based on that.
</p>
<p>In <cite>sh</cite> and <cite>ksh</cite> compatibility modes the following
parameters are not special and not initialized by the shell:
<tt>ARGC</tt>,
<tt>argv</tt>,
<tt>cdpath</tt>,
<tt>fignore</tt>,
<tt>fpath</tt>,
<tt>HISTCHARS</tt>,
<tt>mailpath</tt>,
<tt>MANPATH</tt>,
<tt>manpath</tt>,
<tt>path</tt>,
<tt>prompt</tt>,
<tt>PROMPT</tt>,
<tt>PROMPT2</tt>,
<tt>PROMPT3</tt>,
<tt>PROMPT4</tt>,
<tt>psvar</tt>,
<tt>status</tt>,
<tt>watch</tt>.
</p>
<a name="index-ENV_002c-use-of"></a>
<p>The usual zsh startup/shutdown scripts are not executed. Login shells
source <tt>/etc/profile</tt> followed by <tt>$HOME/.profile</tt>. If the
<tt>ENV</tt> environment variable is set on invocation, <tt>$ENV</tt> is sourced
after the profile scripts. The value of <tt>ENV</tt> is subjected to
parameter expansion, command substitution, and arithmetic expansion
before being interpreted as a pathname. Note that the <tt>PRIVILEGED</tt>
option also affects the execution of startup files.
</p>
<p>The following options are set if the shell is invoked as <tt>sh</tt> or
<tt>ksh</tt>:
<tt>NO_BAD_PATTERN</tt>,
<tt>NO_BANG_HIST</tt>,
<tt>NO_BG_NICE</tt>,
<tt>NO_EQUALS</tt>,
<tt>NO_FUNCTION_ARGZERO</tt>,
<tt>GLOB_SUBST</tt>,
<tt>NO_GLOBAL_EXPORT</tt>,
<tt>NO_HUP</tt>,
<tt>INTERACTIVE_COMMENTS</tt>,
<tt>KSH_ARRAYS</tt>,
<tt>NO_MULTIOS</tt>,
<tt>NO_NOMATCH</tt>,
<tt>NO_NOTIFY</tt>,
<tt>POSIX_BUILTINS</tt>,
<tt>NO_PROMPT_PERCENT</tt>,
<tt>RM_STAR_SILENT</tt>,
<tt>SH_FILE_EXPANSION</tt>,
<tt>SH_GLOB</tt>,
<tt>SH_OPTION_LETTERS</tt>,
<tt>SH_WORD_SPLIT</tt>.
Additionally the <tt>BSD_ECHO</tt> and <tt>IGNORE_BRACES</tt>
options are set if zsh is invoked as <tt>sh</tt>.
Also, the
<tt>KSH_OPTION_PRINT</tt>,
<tt>LOCAL_OPTIONS</tt>,
<tt>PROMPT_BANG</tt>,
<tt>PROMPT_SUBST</tt>
and
<tt>SINGLE_LINE_ZLE</tt>
options are set if zsh is invoked as <tt>ksh</tt>.
</p><hr>
<a name="Restricted-Shell"></a>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="#Compatibility" title="Previous section in reading order"> < </a>]</td>
<td valign="middle" align="left">[<a href="#Invocation" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="Files.html#Files" title="Next section in reading order"> > </a>]</td>
<td valign="middle" align="left">[<a href="Files.html#Files" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Restricted-Shell-1"></a>
<h2 class="section">4.3 Restricted Shell</h2>
<a name="index-restricted-shell"></a>
<a name="index-RESTRICTED"></a>
<p>When the basename of the command used to invoke zsh starts with the letter
‘<tt>r</tt>’ or the ‘<tt>-r</tt>’ command line option is supplied at invocation, the
shell becomes restricted. Emulation mode is determined after stripping the
letter ‘<tt>r</tt>’ from the invocation name. The following are disabled in
restricted mode:
</p>
<ul>
<li> changing directories with the <tt>cd</tt> builtin
</li><li> changing or unsetting the <tt>PATH</tt>, <tt>path</tt>, <tt>MODULE_PATH</tt>,
<tt>module_path</tt>, <tt>SHELL</tt>, <tt>HISTFILE</tt>, <tt>HISTSIZE</tt>, <tt>GID</tt>, <tt>EGID</tt>,
<tt>UID</tt>, <tt>EUID</tt>, <tt>USERNAME</tt>, <tt>LD_LIBRARY_PATH</tt>,
<tt>LD_AOUT_LIBRARY_PATH</tt>, <tt>LD_PRELOAD</tt> and <tt>LD_AOUT_PRELOAD</tt>
parameters
</li><li> specifying command names containing <tt>/</tt>
</li><li> specifying command pathnames using <tt>hash</tt>
</li><li> redirecting output to files
</li><li> using the <tt>exec</tt> builtin command to replace the shell with another
command
</li><li> using <tt>jobs -Z</tt> to overwrite the shell process’ argument and
environment space
</li><li> using the <tt>ARGV0</tt> parameter to override <tt>argv[0]</tt> for external
commands
</li><li> turning off restricted mode with <tt>set +r</tt> or <tt>unsetopt
RESTRICTED</tt>
</li></ul>
<p>These restrictions are enforced after processing the startup files. The
startup files should set up <tt>PATH</tt> to point to a directory of commands
which can be safely invoked in the restricted environment. They may also
add further restrictions by disabling selected builtins.
</p>
<p>Restricted mode can also be activated any time by setting the
<tt>RESTRICTED</tt> option. This immediately enables all the restrictions
described above even if the shell still has not processed all startup
files.
</p><hr>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="#Invocation" title="Beginning of this chapter or previous chapter"> << </a>]</td>
<td valign="middle" align="left">[<a href="Files.html#Files" title="Next chapter"> >> </a>]</td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left"> </td>
<td valign="middle" align="left">[<a href="index.html#Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="zsh_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="Concept-Index.html#Concept-Index" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="zsh_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<p><font size="-1">
This document was generated on <em>February 7, 2016</em> using <a href="http://www.gnu.org/software/texinfo/"><em>texi2any</em></a>.
</font></p>
<font size="-1">Zsh version 5.1.1, released on September 11, 2015.</font>
</body>
</html>
|