summaryrefslogtreecommitdiff
path: root/devdocs/bash/double-quotes.html
blob: 7be7198b21c1cc7aac7bd1b109a4b81140633e47 (plain)
1
2
3
4
5
6
<h1 class="subsubsection">Double Quotes</h1> <p>Enclosing characters in double quotes (‘<samp>"</samp>’) preserves the literal value of all characters within the quotes, with the exception of ‘<samp>$</samp>’, ‘<samp>`</samp>’, ‘<samp>\</samp>’, and, when history expansion is enabled, ‘<samp>!</samp>’. When the shell is in <small>POSIX</small> mode (see <a href="bash-posix-mode">Bash POSIX Mode</a>), the ‘<samp>!</samp>’ has no special meaning within double quotes, even when history expansion is enabled. The characters ‘<samp>$</samp>’ and ‘<samp>`</samp>’ retain their special meaning within double quotes (see <a href="shell-expansions">Shell Expansions</a>). The backslash retains its special meaning only when followed by one of the following characters: ‘<samp>$</samp>’, ‘<samp>`</samp>’, ‘<samp>"</samp>’, ‘<samp>\</samp>’, or <code>newline</code>. Within double quotes, backslashes that are followed by one of these characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. If enabled, history expansion will be performed unless an ‘<samp>!</samp>’ appearing in double quotes is escaped using a backslash. The backslash preceding the ‘<samp>!</samp>’ is not removed. </p> <p>The special parameters ‘<samp>*</samp>’ and ‘<samp>@</samp>’ have special meaning when in double quotes (see <a href="shell-parameter-expansion">Shell Parameter Expansion</a>). </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/Double-Quotes.html" class="_attribution-link">https://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html</a>
  </p>
</div>