bash-hackers-wiki/scripting/debuggingtips/index.html

94 lines
68 KiB
HTML
Raw Normal View History

<!doctype html><html lang=en class=no-js> <head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link href=https://flokoe.github.io/bash-hackers-wiki/scripting/debuggingtips/ rel=canonical><link href=../basics/ rel=prev><link href=../newbie_traps/ rel=next><link rel=icon href=../../assets/images/favicon.png><meta name=generator content="mkdocs-1.6.1, mkdocs-material-9.5.44"><title>Debugging a script - The Bash Hackers Wiki</title><link rel=stylesheet href=../../assets/stylesheets/main.0253249f.min.css><link rel=stylesheet href=../../assets/stylesheets/palette.06af60db.min.css><link rel=preconnect href=https://fonts.gstatic.com crossorigin><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback"><style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style><script>__md_scope=new URL("../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script></head> <body dir=ltr data-md-color-scheme=default data-md-color-primary=indigo data-md-color-accent=indigo> <input class=md-toggle data-md-toggle=drawer type=checkbox id=__drawer autocomplete=off> <input class=md-toggle data-md-toggle=search type=checkbox id=__search autocomplete=off> <label class=md-overlay for=__drawer></label> <div data-md-component=skip> <a href=#debugging-a-script class=md-skip> Skip to content </a> </div> <div data-md-component=announce> </div> <header class=md-header data-md-component=header> <nav class="md-header__inner md-grid" aria-label=Header> <a href=../.. title="The Bash Hackers Wiki" class="md-header__button md-logo" aria-label="The Bash Hackers Wiki" data-md-component=logo> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg> </a> <label class="md-header__button md-icon" for=__drawer> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg> </label> <div class=md-header__title data-md-component=header-title> <div class=md-header__ellipsis> <div class=md-header__topic> <span class=md-ellipsis> The Bash Hackers Wiki </span> </div> <div class=md-header__topic data-md-component=header-topic> <span class=md-ellipsis> Debugging a script </span> </div> </div> </div> <form class=md-header__option data-md-component=palette> <input class=md-option data-md-color-media data-md-color-scheme=default data-md-color-primary=indigo data-md-color-accent=indigo aria-label="Switch to dark mode" type=radio name=__palette id=__palette_0> <label class="md-header__button md-icon" title="Switch to dark mode" for=__palette_1 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 8a4 4 0 0 0-4 4 4 4 0 0 0 4 4 4 4 0 0 0 4-4 4 4 0 0 0-4-4m0 10a6 6 0 0 1-6-6 6 6 0 0 1 6-6 6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg> </label> <input class=md-option data-md-color-media data-md-color-scheme=slate data-md-color-primary=indigo data-md-color-accent=indigo aria-label="Switch to light mode" type=radio name=__palette id=__palette_1> <label class="md-header__button md-icon" title="Switch to light mode" for=__palette_0 hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M12 18c-.89 0-1.74-.2-2.5-.55C11.56 16.5 13 14.42 13 12s-1.44-4.5-3.5-5.45C10.26 6.2 11.11 6 12 6a6 6 0 0 1 6 6 6 6 0 0 1-6 6m8-9.31V4h-4.69L12 .69 8.69 4H4v4.69L.69 12 4 15.31V20h4.69L12 23.31 15.31 20H20v-4.69L23.31 12z"/></svg> </label> </form> <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-c
</code></pre></div> <p>If you read input from <strong>anywhere</strong>, such as a file or <a href=../../syntax/expansion/cmdsubst/ >command substitution</a>, print the debug output with literal quotes, to see leading and trailing spaces!</p> <div class=highlight><pre><span></span><code>pid=$(&lt; fooservice.pid)
echo &quot;DEBUG: read from file: pid=\&quot;$pid\&quot;&quot; &gt;&amp;2
</code></pre></div> <p>Bash's <a href=../../commands/builtin/printf/ >printf</a> command has the <code>%q</code> format, which is handy for verifying whether strings are what they appear to be.</p> <div class=highlight><pre><span></span><code>foo=$(&lt; inputfile)
printf &quot;DEBUG: foo is |%q|\n&quot; &quot;$foo&quot; &gt;&amp;2
# exposes whitespace (such as CRs, see below) and non-printing characters
</code></pre></div> <h2 id=use-shell-debug-output>Use shell debug output<a class=headerlink href=#use-shell-debug-output title="Permanent link">&para;</a></h2> <p>There are two useful debug outputs for that task (both are written to <code>stderr</code>):</p> <ul> <li><code>set -v</code> mode (<code>set -o verbose</code>)<ul> <li>print commands to be executed to <code>stderr</code> as if they were read from input (script file or keyboard)</li> <li>print everything <strong>before</strong> any (<a href=../../syntax/expansion/intro/ >substitution and expansion</a>, ...) is applied</li> </ul> </li> <li><code>set -x</code> mode (<code>set -o xtrace</code>)<ul> <li>print everything as if it were executed, after <a href=../../syntax/expansion/intro/ >substitution and expansion</a> is applied</li> <li>indicate the depth-level of the subshell (by default by prefixing a <code>+</code> (plus) sign to the displayed command)</li> <li>indicate the recognized words after <a href=../../syntax/expansion/wordsplit/ >word splitting</a> by marking them like <code>'x y'</code></li> <li>in shell version 4.1, this debug output can be printed to a configurable file descriptor, rather than sdtout by setting the <a href=../../syntax/shellvars/#BASH_XTRACEFD>BASH_XTRACEFD</a> variable.</li> </ul> </li> </ul> <p><strong><u>Hint:</u></strong> These modes can be entered when calling Bash:</p> <ul> <li>from commandline: <code>bash -vx ./myscript</code></li> <li>from shebang (OS dependant): <code>#!/bin/bash -vx</code></li> </ul> <h3 id=simple-example-of-how-to-interpret-xtrace-output>Simple example of how to interpret xtrace output<a class=headerlink href=#simple-example-of-how-to-interpret-xtrace-output title="Permanent link">&para;</a></h3> <p>Here's a simple command (a string comparison using the <a href=../../commands/classictest/ >classic test command</a>) executed while in <code>set -x</code> mode:</p> <div class=highlight><pre><span></span><code>set -x
foo=&quot;bar baz&quot;
[ $foo = test ]
</code></pre></div> <p>That fails. Why? Let's see the <code>xtrace</code> output:</p> <div class=highlight><pre><span></span><code>+ &#39;[&#39; bar baz = test &#39;]&#39;
</code></pre></div> <p>And now you see that it's ("bar" and "baz") recognized as two separate words (which you would have realized if you READ THE ERROR MESSAGES ;) ). Let's check it...</p> <div class=highlight><pre><span></span><code># next try
[ &quot;$foo&quot; = test ]
</code></pre></div> <p><code>xtrace</code> now gives</p> <div class=highlight><pre><span></span><code>+ &#39;[&#39; &#39;bar baz&#39; = test &#39;]&#39;
^ ^
word markers!
</code></pre></div> <h3 id=making-xtrace-more-useful>Making xtrace more useful<a class=headerlink href=#making-xtrace-more-useful title="Permanent link">&para;</a></h3> <p>(by AnMaster)</p> <p><code>xtrace</code> output would be more useful if it contained source file and line number. Add this assignment <a href=../../syntax/shellvars/#PS4>PS4</a> at the beginning of your script to enable the inclusion of that information:</p> <div class=highlight><pre><span></span><code>export PS4=&#39;+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }&#39;
</code></pre></div> <p><strong>Be sure to use single quotes here!</strong></p> <p>The output would look like this when you trace code <em>outside a function</em>:</p> <div class=highlight><pre><span></span><code>+(somefile.bash:412): echo &#39;Hello world&#39;
</code></pre></div> <p>...and like this when you trace code <em>inside a function</em>:</p> <div class=highlight><pre><span></span><code>+(somefile.bash:412): myfunc(): echo &#39;Hello world&#39;
</code></pre></div> <p>That helps a lot when the script is long, or when the main script sources many other files.</p> <h4 id=set-flag-variables-with-descriptive-words>Set flag variables with descriptive words<a class=headerlink href=#set-flag-variables-with-descriptive-words title="Permanent link">&para;</a></h4> <p>If you test variables that flag the state of options, such as with <code>if [[ -n $option ]];</code>, consider using descriptive words rather than short codes, such as 0, 1, Y, N, because xtrace will show <code>[[ -n word ]]</code> rather than <code>[[ -n 1 ]]</code> when the option is set.</p> <h2 id=debugging-commands-depending-on-a-set-variable>Debugging commands depending on a set variable<a class=headerlink href=#debugging-commands-depending-on-a-set-variable title="Permanent link">&para;</a></h2> <p>For general debugging purposes you can also define a function and a variable to use:</p> <div class=highlight><pre><span></span><code>debugme() {
[[ $script_debug = 1 ]] &amp;&amp; &quot;$@&quot; || :
# be sure to append || : or || true here or use return 0, since the return code
# of this function should always be 0 to not influence anything else with an unwanted
# &quot;false&quot; return code (for example the script&#39;s exit code if this function is used
# as the very last command in the script)
}
</code></pre></div> <p>This function does nothing when <code>script_debug</code> is unset or empty, but it executes the given parameters as commands when <code>script_debug</code> is set. Use it like this:</p> <div class=highlight><pre><span></span><code>script_debug=1
# to turn it off, set script_debug=0
debugme logger &quot;Sorting the database&quot;
database_sort
debugme logger &quot;Finished sorting the database, exit code $?&quot;
</code></pre></div> <p>Of course this can be used to execute something other than echo during debugging:</p> <div class=highlight><pre><span></span><code>debugme set -x
# ... some code ...
debugme set +x
</code></pre></div> <h2 id=dry-run-stdin-driven-commands>Dry-run STDIN driven commands<a class=headerlink href=#dry-run-stdin-driven-commands title="Permanent link">&para;</a></h2> <p>Imagine you have a script that runs FTP commands using the standard FTP client:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a>ftp<span class=w> </span>user@host<span class=w> </span><span class=s>&lt;&lt;FTP</span>
<a id=__codelineno-0-2 name=__codelineno-0-2 href=#__codelineno-0-2></a><span class=s>cd /data</span>
<a id=__codelineno-0-3 name=__codelineno-0-3 href=#__codelineno-0-3></a><span class=s>get current.log</span>
<a id=__codelineno-0-4 name=__codelineno-0-4 href=#__codelineno-0-4></a><span class=s>dele current.log</span>
<a id=__codelineno-0-5 name=__codelineno-0-5 href=#__codelineno-0-5></a><span class=s>FTP</span>
</code></pre></div> <p>A method to dry-run this with debug output is:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-1-1 name=__codelineno-1-1 href=#__codelineno-1-1></a><span class=k>if</span><span class=w> </span><span class=o>[[</span><span class=w> </span><span class=nv>$DRY_RUN</span><span class=w> </span><span class=o>=</span><span class=w> </span>yes<span class=w> </span><span class=o>]]</span><span class=p>;</span><span class=w> </span><span class=k>then</span>
<a id=__codelineno-1-2 name=__codelineno-1-2 href=#__codelineno-1-2></a><span class=w> </span>sed<span class=w> </span><span class=s1>&#39;s/^/DRY_RUN FTP: /&#39;</span>
<a id=__codelineno-1-3 name=__codelineno-1-3 href=#__codelineno-1-3></a><span class=k>else</span>
<a id=__codelineno-1-4 name=__codelineno-1-4 href=#__codelineno-1-4></a><span class=w> </span>ftp<span class=w> </span>user@host
<a id=__codelineno-1-5 name=__codelineno-1-5 href=#__codelineno-1-5></a><span class=k>fi</span><span class=w> </span><span class=s>&lt;&lt;FTP</span>
<a id=__codelineno-1-6 name=__codelineno-1-6 href=#__codelineno-1-6></a><span class=s>cd /data</span>
<a id=__codelineno-1-7 name=__codelineno-1-7 href=#__codelineno-1-7></a><span class=s>get current.log</span>
<a id=__codelineno-1-8 name=__codelineno-1-8 href=#__codelineno-1-8></a><span class=s>dele current.log</span>
<a id=__codelineno-1-9 name=__codelineno-1-9 href=#__codelineno-1-9></a><span class=s>FTP</span>
</code></pre></div> <p>This can be wrapped in a shell function for more readable code.</p> <h2 id=common-error-messages>Common error messages<a class=headerlink href=#common-error-messages title="Permanent link">&para;</a></h2> <h3 id=unexpected-end-of-file>Unexpected end of file<a class=headerlink href=#unexpected-end-of-file title="Permanent link">&para;</a></h3> <div class=highlight><pre><span></span><code>script.sh: line 100: syntax error: unexpected end of file
</code></pre></div> <p>Usually indicates exactly what it says: An unexpected end of file. It's unexpected because Bash waits for the closing of a <a href=../../syntax/ccmd/intro/ >compound command</a>:</p> <ul> <li>did you close your <code>do</code> with a <code>done</code>?</li> <li>did you close your <code>if</code> with a <code>fi</code>?</li> <li>did you close your <code>case</code> with a <code>esac</code>?</li> <li>did you close your <code>{</code> with a <code>}</code>?</li> <li>did you close your <code>(</code> with a <code>)</code>?</li> </ul> <p><u><strong>Note:</strong></u> It seems that here-documents (tested on versions <code>1.14.7</code>, <code>2.05b</code>, <code>3.1.17</code> and <code>4.0</code>) are correctly terminated when there is an EOF before the end-of-here-document tag (see <a href=../../syntax/redirection/ >redirection</a>). The reason is unknown, but it seems to be deliberate. Bash 4.0 added an extra message for this: <code>warning: here-document at line &lt;N&gt; delimited by end-of-file (wanted `&lt;MARKER&gt;')</code></p> <h3 id=unexpected-end-of-file-while-looking-for-matching>Unexpected end of file while looking for matching ...<a class=headerlink href=#unexpected-end-of-file-while-looking-for-matching title="Permanent link">&para;</a></h3> <div class=highlight><pre><span></span><code>script.sh: line 50: unexpected EOF while looking for matching `&quot;&#39;
script.sh: line 100: syntax error: unexpected end of file
</code></pre></div> <p>This one indicates the double-quote opened in line 50 does not have a matching closing quote.</p> <p>These <em>unmatched errors</em> occur with:</p> <ul> <li>double-quote pairs</li> <li>single-quote pairs (also <code>$'string'</code>!)</li> <li>missing a closing <code>}</code> with <a href=../../syntax/pe/ >parameter expansion syntax</a></li> </ul> <h3 id=too-many-arguments>Too many arguments<a class=headerlink href=#too-many-arguments title="Permanent link">&para;</a></h3> <div class=highlight><pre><span></span><code>bash: test: too many arguments
</code></pre></div> <p>You most likely forgot to quote a variable expansion somewhere. See the example for <code>xtrace</code> output from above. External commands may display such an error message though in our example, it was the <strong>internal</strong> test-command that yielded the error.</p> <h3 id=event-not-found>!": event not found<a class=headerlink href=#event-not-found title="Permanent link">&para;</a></h3> <div class=highlight><pre><span></span><code>$ echo &quot;Hello world!&quot;
bash: !&quot;: event not found
</code></pre></div> <p>This is not an error per se. It happens in interactive shells, when the C-Shell-styled history expansion ("<code>!searchword</code>") is enabled. This is the default. Disable it like this:</p> <div class=highlight><pre><span></span><code>set +H
# or
set +o histexpand
</code></pre></div> <h3 id=syntax-error-near-unexpected-token>syntax error near unexpected token `(\'<a class=headerlink href=#syntax-error-near-unexpected-token title="Permanent link">&para;</a></h3> <p>When this happens during a script <strong>function definition</strong> or on the commandline, e.g.</p> <div class=highlight><pre><span></span><code>$ foo () { echo &quot;Hello world&quot;; }
bash: syntax error near unexpected token `(&#39;
</code></pre></div> <p>you most likely have an alias defined with the same name as the function (here: <code>foo</code>). Alias expansion happens before the real language interpretion, thus the alias is expanded and makes your function definition invalid.</p> <h2 id=the-crlf-issue>The CRLF issue<a class=headerlink href=#the-crlf-issue title="Permanent link">&para;</a></h2> <h3 id=what-is-the-crlf-issue>What is the CRLF issue?<a class=headerlink href=#what-is-the-crlf-issue title="Permanent link">&para;</a></h3> <p>There's a big difference in the way that UNIX&reg; and Microsoft&reg; (and possibly others) handle the <strong>line endings</strong> of plain text files. The difference lies in the use of the CR (Carriage Return) and LF (Line Feed) characters.</p> <ul> <li>MSDOS uses: <code>\r\n</code> (ASCII <code>CR</code> #13 <code>^M</code>, ASCII LF #10)</li> <li>UNIX&reg; uses: <code>\n</code> (ASCII <code>LF</code> #10)</li> </ul> <p>Keep in mind your script is a <strong>plain text file</strong>, and the <code>CR</code> character means nothing special to UNIX&reg; - it is treated like any other character. If it's printed to your terminal, a carriage return will effectively place the cursor at the beginning of the <em>current</em> line. This can cause much confusion and many headaches, since lines containing CRs are not what they appear to be when printed. In summary, CRs are a pain.</p> <h3 id=how-did-a-cr-end-up-in-my-file>How did a CR end up in my file?<a class=headerlink href=#how-did-a-cr-end-up-in-my-file title="Permanent link">&para;</a></h3> <p>Some possible sources of CRs:</p> <ul> <li>a DOS/Windows text editor</li> <li>a UNIX&reg; text editor that is "too smart" when determining the file content type (and thinks "<em>it's a DOS text file</em>")</li> <li>a direct copy and paste from certain webpages (some pastebins are known for this)</li> </ul> <h3 id=why-do-crs-hurt>Why do CRs hurt?<a class=headerlink href=#why-do-crs-hurt title="Permanent link">&para;</a></h3> <p>CRs can be a nuisance in various ways. They are especially bad when present in the shebang/interpreter specified with <code>#!</code> in the very first line of a script. Consider the following script, written with a Windows&reg; text editor (<code>^M</code> is a symbolic representation of the <code>CR</code> carriage return character!):</p> <div class=highlight><pre><span></span><code>#!/bin/bash^M
^M
echo &quot;Hello world&quot;^M
...
</code></pre></div> <p>Here's what happens because of the <code>#!/bin/bash^M</code> in our shebang:</p> <ul> <li>the file <code>/bin/bash^M</code> doesn't exist (hopefully)</li> <li>So Bash prints an error message which (depending on the terminal, the Bash version, or custom patches!) may or may not expose the problem.</li> <li>the script can't be executed</li> </ul> <p>The error message can vary. If you're lucky, you'll get:</p> <div class=highlight><pre><span></span><code>bash: ./testing.sh: /bin/bash^M: bad interpreter: No such file or directory
</code></pre></div> <p>which alerts you to the CR. But you may also get the following:</p> <div class=highlight><pre><span></span><code>: bad interpreter: No such file or directory
</code></pre></div> <p>Why? Because when printed literally, the <code>^M</code> makes the cursor go back to the beginning of the line. The whole error message is <em>printed</em>, but you <em>see</em> only part of it!</p> <div class="admonition warning"> <p class=admonition-title>warning</p> <p>It's easy to imagine the <code>^M</code> is bad in other places too. If you get weird and illogical messages from your script, rule out the possibility that<code>^M</code> is involved. Find and eliminate it!</p> </div> <h3 id=how-can-i-find-and-eliminate-them>How can I find and eliminate them?<a class=headerlink href=#how-can-i-find-and-eliminate-them title="Permanent link">&para;</a></h3> <p><strong>To display</strong> CRs (these are only a few examples)</p> <ul> <li>in VI/VIM: <code>:set list</code></li> <li>with <code>cat(1)</code>: <code>cat -v FILE</code></li> </ul> <p><strong>To eliminate</strong> them (only a few examples)</p> <ul> <li>blindly with <code>tr(1)</code>: <code>tr -d '\r' &lt;FILE &gt;FILE.new</code></li> <li>controlled with <code>recode(1)</code>: <code>recode MSDOS..latin1 FILE</code></li> <li>controlled with <code>dos2unix(1)</code>: <code>dos2unix FILE</code></li> </ul> <h2 id=see-also>See also<a class=headerlink href=#see-also title="Permanent link">&para;</a></h2> <ul> <li><a href=../../commands/builtin/set/ >the set builtin command</a> (for <code>-v</code> and <code>-x</code>)</li> </ul> <div class="admonition warning"> <p class=admonition-title>FIXME</p> <p>tbd.</p> </div> <ul> <li>DEBUG trap</li> <li>BASH Debugger <a href=http://bashdb.sourceforge.net/ >http://bashdb.sourceforge.net/</a></li> </ul> <aside class=md-source-file> <span class=md-source-file__fact> <span class=md-icon title="Last update"> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M21 13.1c-.1 0-.3.1-.4.2l-1 1 2.1 2.1 1-1c.2-.2.2-.6 0-.8l-1.3-1.3c-.1-.1-.2-.2-.4-.2m-1.9 1.8-6.1 6V23h2.1l6.1-6.1zM12.5 7v5.2l4 2.4-1 1L11 13V7zM11 21.9c-5.1-.5-9-4.8-9-9.9C2 6.5 6.5 2 12 2c5.3 0 9.6 4.1 10 9.3-.3-.1-.6-.2-1-.2s-.7.1-1 .2C19.6 7.2 16.2 4 12 4c-4.4 0-8 3.6-8 8 0 4.1 3.1 7.5 7.1 7.9l-.1.2z"/></svg> </span> <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">November 7, 2024</span> </span> <span class=md-source-file__fact> <span class=md-icon title=Created> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M14.47 15.08 11 13V7h1.5v5.25l3.08 1.83c-.41.28-.79.62-1.11 1m-1.39 4.84c-.36.05-.71.08-1.08.08-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8c0 .37-.03.72-.08 1.08.69.1 1.33.32 1.92.64.1-.56.16-1.13.16-1.72 0-5.5-4.5-10-10-10S2 6.5 2 12s4.47 10 10 10c.59 0 1.16-.06 1.72-.16-.32-.59-.54-1.23-.64-1.92M18 15v3h-3v2h3v3h2v-3h3v-2h-3v-3z"/></svg> </span> <span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">November 7, 2024</span> </span> </aside> <h2 id=__comments>Comments</h2> <script src=https://giscus.app/client.js data-repo=flokoe/bash-hackers-wiki data-repo-id=R_kgDOJ3Nr6Q data-category="Giscus Page Comments" data-category-id=DIC_kwDOJ3Nr6c4CXq9t data-mapping=pathname data-strict=1 data-reactions-enabled=1 data-emit-metadata=0 data-input-position=top data-theme=preferred_color_scheme data-lang=en data-loading=lazy crossorigin=anonymous async>
</script> <script>
var giscus = document.querySelector("script[src*=giscus]")
/* Set palette on initial load */
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
giscus.setAttribute("data-theme", theme)
}
/* Register event handlers after documented loaded */
document.addEventListener("DOMContentLoaded", function() {
var ref = document.querySelector("[data-md-component=palette]")
ref.addEventListener("change", function() {
var palette = __md_get("__palette")
if (palette && typeof palette.color === "object") {
var theme = palette.color.scheme === "slate" ? "dark" : "light"
/* Instruct Giscus to change theme */
var frame = document.querySelector(".giscus-frame")
frame.contentWindow.postMessage(
{ giscus: { setConfig: { theme } } },
"https://giscus.app"
)
}
})
})
</script> </article> </div> <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script> </div> <button type=button class="md-top md-icon" data-md-component=top hidden> <svg xmlns=http://www.w3.org/2000/svg viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8z"/></svg> Back to top </button> </main> <footer class=md-footer> <div class="md-footer-meta md-typeset"> <div class="md-footer-meta__inner md-grid"> <div class=md-copyright> Made with <a href=https://squidfunk.github.io/mkdocs-material/ target=_blank rel=noopener> Material for MkDocs </a> </div> </div> </div> </footer> </div> <div class=md-dialog data-md-component=dialog> <div class="md-dialog__inner md-typeset"></div> </div> <script id=__config type=application/json>{"base": "../..", "features": ["navigation.instant", "navigation.tracking", "navigation.tabs", "navigation.sections", "navigation.top", "content.action.view", "content.action.edit", "search.suggest", "search.highlight", "content.code.copy"], "search": "../../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}}</script> <script src=../../assets/javascripts/bundle.83f73b43.min.js></script> </body> </html>