<h1 id="basic-bash-prompt-information">Basic bash prompt information</h1>
<ul>
<li>Variables and files
<ul>
<li><code>.bashrc</code>: the RC file where all of this stuff can be set</li>
<li><code>PS1</code>: main prompt variable</li>
<li><code>PS2</code>: continuation prompt</li>
<li><code>PROMPT_COMMAND</code>: a bash function name, run every time prompt is displayed</li>
</ul></li>
<li>Colors
<ul>
<li>Uses <a href="https://www.tldp.org/LDP/abs/html/colorizing.html">escape sequences</a></li>
<li>There are problems with prompts and escape sequences
<ul>
<li>Multiple escaping</li>
<li>String interpretation and variable expansion</li>
</ul></li>
<li>tput to the rescue!
<ul>
<li>Takes away the need for complex escape codes</li>
<li>Must run <code>tput init</code> at the beginning of your <code>.bashrc</code> file</li>
<li>TL;DR: Use tput for color strings, add them at the last possible moment, with brackets and backslashes</li>
</ul></li>
</ul></li>
<li>Embedding bash scripts
<ul>
<li>Single quotes are king</li>
<li>Will be run every time PS1 is evaluated</li>
<li>Otherwise, only run at time of assignment</li>
</ul></li>
</ul>
<h1 id="layout-of-my-prompt">Layout of my prompt</h1>
<ul>
<li>Two lines
<ul>
<li>Information/status line</li>
<li>Prompt line</li>
</ul></li>
<li>Status line
<ul>
<li>Starts with current username
<ul>
<li>Changes color when user has mail</li>
</ul></li>
<li>Next is the hostname (truncated)
<ul>
<li>Separated by an @ symbol, like an email address</li>
<li>Changes color when the system is in need of a reboot</li>
<li>Checks for /run/reboot_required</li>
</ul></li>
<li>Current directory
<ul>
<li>Separated from previous items by a pipe</li>
<li>Truncated with a tilde if user's home is in the path</li>
<li>Prepended with a number indicating the directory stack, if present</li>
<li>Appended with the git (±) symbol if we're in a git branch, followed by the name of the branch</li>
</ul></li>
</ul></li>
<li>Prompt line
<ul>
<li>A blue » character</li>
<li>Prepended with the number of background processes spawned from this terminal</li>
</ul></li>
</ul>
<p>Screenshot:</p>
<p><img src="https://fragdev.com/media/img/prompt.png" alt="A screenshot of my bash prompt, both initially and with all of the bells and whistles showing" /></p>

<h3>Link to Git Repository</h3>
<ul><li><a href="https://gitlab.com/windigo-configs/bash.git">https://gitlab.com/windigo-configs/bash.git</a></li></ul>
<p><small><small><em>Editor's Note: added 2017-08-05</em></small></small></p>
