<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Linux on Abel G. Vidal</title><link>https://abelgvidal.com/tags/linux/</link><description>Recent content in Linux on Abel G. Vidal</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 03 Jan 2025 20:03:54 +0100</lastBuildDate><atom:link href="https://abelgvidal.com/tags/linux/index.xml" rel="self" type="application/rss+xml"/><item><title>Why 'type type type type' runs three times in Bash</title><link>https://abelgvidal.com/posts/recursive-bash/</link><pubDate>Fri, 03 Jan 2025 20:03:54 +0100</pubDate><guid>https://abelgvidal.com/posts/recursive-bash/</guid><description>&lt;p>In Bash, when we run the command &lt;code>type type type type&lt;/code>, we observe a peculiar behavior: it executes three times instead of once or four times. This phenomenon is fascinating and is due to how Bash processes arguments and how the &lt;code>type&lt;/code> command specifically works.&lt;/p>
&lt;h2 id="the-behavior-of-type">The behavior of &lt;code>type&lt;/code>&lt;/h2>
&lt;p>The &lt;code>type&lt;/code> command is a Bash builtin used to determine how Bash would interpret a command name. When we execute:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#6639ba">type&lt;/span> &lt;span style="color:#6639ba">type&lt;/span> &lt;span style="color:#6639ba">type&lt;/span> &lt;span style="color:#6639ba">type&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>We get an output similar to this:&lt;/p></description></item></channel></rss>