summaryrefslogtreecommitdiff
path: root/devdocs/bash/shell-operation.html
blob: a59209f929a56070049fa227a6f71a2492911567 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
<h1 class="subsection">Shell Operation</h1> <p>The following is a brief description of the shell’s operation when it reads and executes a command. Basically, the shell does the following: </p> <ol> <li> Reads its input from a file (see <a href="shell-scripts">Shell Scripts</a>), from a string supplied as an argument to the <samp>-c</samp> invocation option (see <a href="invoking-bash">Invoking Bash</a>), or from the user’s terminal. </li>
<li> Breaks the input into words and operators, obeying the quoting rules described in <a href="quoting">Quoting</a>. These tokens are separated by <code>metacharacters</code>. Alias expansion is performed by this step (see <a href="aliases">Aliases</a>). </li>
<li> Parses the tokens into simple and compound commands (see <a href="shell-commands">Shell Commands</a>). </li>
<li> Performs the various shell expansions (see <a href="shell-expansions">Shell Expansions</a>), breaking the expanded tokens into lists of filenames (see <a href="filename-expansion">Filename Expansion</a>) and commands and arguments. </li>
<li> Performs any necessary redirections (see <a href="redirections">Redirections</a>) and removes the redirection operators and their operands from the argument list. </li>
<li> Executes the command (see <a href="executing-commands">Executing Commands</a>). </li>
<li> Optionally waits for the command to complete and collects its exit status (see <a href="exit-status">Exit Status</a>). </li>
</ol><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/Shell-Operation.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Shell-Operation.html</a>
  </p>
</div>