summaryrefslogtreecommitdiff
path: root/devdocs/bash/lists.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/bash/lists.html')
-rw-r--r--devdocs/bash/lists.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/devdocs/bash/lists.html b/devdocs/bash/lists.html
new file mode 100644
index 00000000..c4ba990e
--- /dev/null
+++ b/devdocs/bash/lists.html
@@ -0,0 +1,12 @@
+<h1 class="subsection">Lists of Commands</h1> <p>A <code>list</code> is a sequence of one or more pipelines separated by one of the operators ‘<samp>;</samp>’, ‘<samp>&amp;</samp>’, ‘<samp>&amp;&amp;</samp>’, or ‘<samp>||</samp>’, and optionally terminated by one of ‘<samp>;</samp>’, ‘<samp>&amp;</samp>’, or a <code>newline</code>. </p> <p>Of these list operators, ‘<samp>&amp;&amp;</samp>’ and ‘<samp>||</samp>’ have equal precedence, followed by ‘<samp>;</samp>’ and ‘<samp>&amp;</samp>’, which have equal precedence. </p> <p>A sequence of one or more newlines may appear in a <code>list</code> to delimit commands, equivalent to a semicolon. </p> <p>If a command is terminated by the control operator ‘<samp>&amp;</samp>’, the shell executes the command asynchronously in a subshell. This is known as executing the command in the <em>background</em>, and these are referred to as <em>asynchronous</em> commands. The shell does not wait for the command to finish, and the return status is 0 (true). When job control is not active (see <a href="job-control">Job Control</a>), the standard input for asynchronous commands, in the absence of any explicit redirections, is redirected from <code>/dev/null</code>. </p> <p>Commands separated by a ‘<samp>;</samp>’ are executed sequentially; the shell waits for each command to terminate in turn. The return status is the exit status of the last command executed. </p> <p><small>AND</small> and <small>OR</small> lists are sequences of one or more pipelines separated by the control operators ‘<samp>&amp;&amp;</samp>’ and ‘<samp>||</samp>’, respectively. <small>AND</small> and <small>OR</small> lists are executed with left associativity. </p> <p>An <small>AND</small> list has the form </p>
+<div class="example"> <pre class="example">command1 &amp;&amp; command2
+</pre>
+</div> <p><var>command2</var> is executed if, and only if, <var>command1</var> returns an exit status of zero (success). </p> <p>An <small>OR</small> list has the form </p>
+<div class="example"> <pre class="example">command1 || command2
+</pre>
+</div> <p><var>command2</var> is executed if, and only if, <var>command1</var> returns a non-zero exit status. </p> <p>The return status of <small>AND</small> and <small>OR</small> lists is the exit status of the last command executed in the list. </p><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>Licensed under the GNU Free Documentation License.<br>
+ <a href="https://www.gnu.org/software/bash/manual/html_node/Lists.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Lists.html</a>
+ </p>
+</div>