Content-Security-Policy: default-src 'none'
Content-Type: text/plain; charset=UTF-8
Content-Length: 6385
Content-Disposition: inline; filename="prompt.bash"
Last-Modified: Sun, 06 Apr 2025 12:55:11 GMT
Expires: Wed, 04 Apr 2035 12:55:11 GMT
ETag: "225b776ec05514377e78443c34c05842db5c6c08"

#!/usr/bin/env bash
# vim:syntax=sh:ts=4

# ----- PROMPT COLOURS ----- #
fgcolor () {
	#echo "\\[\\033[38;5;"$1"m\\]"
	echo "\033[38;5;${1}m"
}
fgtcolor () {
	echo "\033[38;2;$1;$2;$3m"
}
bgcolor () {
	#echo "\\[\\033[48;5;"$1"m\\]"
	echo "\033[48;5;${1}m"
}
#  This is Solaris bash compatible, so we cannot use + here for "at least once) but instead use the
#   stupid old asterisk (*). Well, here hetting "no digits" practically won't hurt.
MYUID="$(id|sed 's/.*uid=\([0-9]*\).*/\1/g')";export MYUID
#   ...because "empty" will hit the "any" condition in the end :)
OSMAJVER="$(grep '^VERSION_ID' /etc/os-release|awk -F= '{print $NF}'|sed 's/"//g'|awk -F\. '{print $1}')"
case "$MYUID" in
	0)
		FGC1="fgcolor 88"
		case "$OSNAME" in
			debian)
				# Debian 12 = emerald
				if [ "$OSMAJVER" -ge 12 ];then
							FGC3="fgcolor 36";FGC2="fgtcolor 155 15 64"
				else
							FGC3="fgcolor 38";FGC2="fgtcolor 155 15 64"
				fi
			;;
			arch)			FGC2="fgcolor 24";FGC3="fgcolor 240";;
			redhat)			FGC1="fgcolor 23";FGC2="fgcolor 88";FGC3="fgcolor 203";;
			fedora)			FGC1="fgcolor 160";FGC2="fgcolor 88";FGC3="fgcolor 203";;
			# with the advent of Rocky, we'll match the time to SUSE's blue and the hostname to
			# the colour of Geeko:
			#*suse|aix)		FGC2="fgcolor 22";FGC3="fgcolor 41";;
			*sles*)			FGC2="fgcolor 22";FGC3="fgcolor 83";;
			*suse*)
				case "$OSNAME" in
					*leap)	FGC2="fgcolor 214";FGC3="fgcolor 83";;
					*)		FGC2="fgcolor 30";FGC3="fgcolor 83";;
				esac
			;;
			aix)			FGC2="fgcolor 238";FGC3="fgcolor 83";;
			*centos*)		FGC2="fgcolor 25";FGC3="fgcolor 208";;
			*solaris)		FGC2="fgcolor 31";FGC3="fgcolor 124";;
			ubuntu)
				if [ "$OSMAJVER" -ge 22 ];then
					if printf "%b" "$TERM"|grep -P 'xterm|256' > /dev/null;then
							FGC2="fgcolor 89";FGC3="fgcolor 208"
					else
							FGC2="fgcolor 53";FGC3="fgcolor 184"
					fi
				else
							FGC2="fgcolor 130";FGC3="fgcolor 215"
				fi
			;;
			rasp*)			FGC2="fgcolor 253";FGC3="fgcolor 126";;
			rocky)			FGC2="fgcolor 22";FGC3="fgcolor 41";;
			*)				FGC2="fgcolor 240";FGC3="fgcolor 244";;
		esac
		if [ -n "$TERMUX_APK_RELEASE" ]; then
			if [ "$TERMUX_APK_RELEASE" == "F_DROID" ]; then
				FGC2="fgcolor 27";FGC3="fgcolor 35"
			fi
		fi
	;;
	*)
		FGC2="fgcolor 253"
		case "$OSNAME" in
			debian)
				if [ "$OSMAJVER" -ge 12 ];then
							FGC1="fgtcolor 155 15 64";FGC3="fgcolor 36"
				else
							FGC1="fgtcolor 155 15 64";FGC3="fgcolor 38"
				fi
			;;
			arch)			FGC1="fgcolor 24";FGC3="fgcolor 239";;
			redhat)			FGC1="fgcolor 23";FGC3="fgcolor 88";;
			fedora)			FGC1="fgcolor 88";FGC3="fgcolor 203";;
			#*suse|aix)		FGC1="fgcolor 22";FGC3="fgcolor 41";;
			*sles*)			FGC1="fgcolor 22";FGC3="fgcolor 83";;
			*suse*)
				case "$OSNAME" in
					*leap)	FGC1="fgcolor 214";FGC3="fgcolor 83";;
					*)		FGC1="fgcolor 30";FGC3="fgcolor 83";;
				esac
			;;
			aix)			FGC1="fgcolor 238";FGC3="fgcolor 83";;
			*centos*)		FGC1="fgcolor 25";FGC3="fgcolor 208";;
			*solaris)		FGC1="fgcolor 31";FGC3="fgcolor 124";;
			ubuntu)
				if [ "$OSMAJVER" -ge 22 ];then
					if printf "%b" "$TERM"|grep -P 'xterm|256' > /dev/null;then
							FGC1="fgcolor 89";FGC3="fgcolor 208"
					else
							FGC1="fgcolor 53";FGC3="fgcolor 184"
					fi
				else
							FGC1="fgcolor 130";FGC3="fgcolor 215"
				fi
			;;
			rasp*)			FGC1="fgcolor 53";FGC3="fgcolor 126";;
			rocky)			FGC1="fgcolor 22";FGC3="fgcolor 41";;
			*)				FGC1="fgcolor 240";FGC3="fgcolor 244";;
		esac
		if [ -n "$TERMUX_APK_RELEASE" ]; then
			if [ "$TERMUX_APK_RELEASE" == "F_DROID" ]; then
				FGC1="fgcolor 27";FGC3="fgcolor 35"
			fi
		fi
	;;
esac
# HYPERVISOR LAYER 8 SOFTWARE
if pveversion > /dev/null 2>&1;then
	FGC1="fgcolor 236";FGC3="fgcolor 130"
fi
# make it possible to draw user-defined colours
# shellcheck disable=SC1090,SC1091
[ -r "${BBD}/prompt.bash.local" ] && source "${BBD}/prompt.bash.local"

# ----- USER SEP. AND HOSTNAME ----- #
UHSEP="@"
[ -n "$TMUX_PANE" ]&&UHSEP="[T]"
[ -n "$BYOBU_WINDOW_NAME" ]&&UHSEP="[B]"
[ "$(hostname -s)" == "monitoring" ]&&PHN="$(hostname -f)"||PHN="$(hostname -s)"

# ----- ASSEMBLE THE PROMPT COMMAND ADDITION ----- #
__prompt_command() {
	local EXIT="$?"
	if [ "$EXIT" -lt 10 ];then
		local EXIT2="00$EXIT"
	elif [ "$EXIT" -lt 100 ];then
		local EXIT2="0$EXIT"
	else
		local EXIT2="$EXIT"
	fi
	case "$MYUID" in
		0)
			PS1="\\# \[$(tput bold)\]\[$($FGC1)\]\\u\[$($FGC2)\]@$PHN \[$($FGC3)\]\\w \[$(tput sgr0)\]\\n"
		;;
		*)
			PS1="\\# \[$(tput bold)\]\[$($FGC1)\]\t \[$($FGC2)\]\\u$UHSEP\[$($FGC3)\]$PHN \\w \[$(tput sgr0)\]\\n"
		;;
	esac
	# git-completion. Sources:
	# - https://github.com/git/git/tree/master/contrib/completion (main)
	# - https://github.com/felipec/git-completion (fork)
	# - Debian: easygit
	# - Arch: git-completion (AUR, with functionality tests) - search for ...share/git(-completion)?/prompt.sh
	# - Manual measure: this repository, /git-prompt
	# Why all this fuss? magicmonty takes control over the whole prompt, __git_ps1 only serves a part
	# of it. We don't like monoliths, we like modules; the latter is good practice.
	# also, see postexec --> one-time sourcing of git's prompt.sh
	if command -v __git_ps1 >/dev/null 2>&1;then
		GIT_PS1_SHOWCOLORHINTS=1
		PS1+="$(__git_ps1 "%s ")"
	fi
	if [ "$EXIT" -eq 0 ];then
		PS1+="\[\033[0;32m\]# "
	elif [ "$EXIT" -eq 255 ]||[ "$EXIT" -eq 127 ];then
		PS1+="\[\033[0;33m\]$EXIT2 # "
	elif [ "$EXIT" -eq 130 ];then
		 PS1+="\[\033[0;35m\]$EXIT2 # "
	else
		PS1+="\[\033[0;31m\]$EXIT2 # "
	fi
	PS1+="\[\033[0m\]"
}

# ----- ADD __prompt_command() TO $PROMPT_COMMAND ----- #
if ! printf "%b" "$PROMPT_COMMAND" | grep '__prompt_command' >/dev/null;then
	case "$TERM" in
		# adding in "screen" because tmux
		xterm|xterm-color|xterm-256color|rxvt*|screen-256color|screen)
			if [ -n "$PROMPT_COMMAND" ];then
				export PROMPT_COMMAND="__prompt_command;${PROMPT_COMMAND}"
			else
				export PROMPT_COMMAND="__prompt_command"
			fi
		;;
		*)
			if [ -n "$PROMPT_COMMAND" ];then
				export PROMPT_COMMAND="__prompt_command;${PROMPT_COMMAND}"
			else
				export PROMPT_COMMAND="__prompt_command"
			fi
		;;
	esac
fi
# ----- HISTORY SUBMISSION IN $PROMPT_COMMAND ----- #
if ! printf "%b" "$PROMPT_COMMAND"|grep 'history -a' >/dev/null;then
	if [ -n "$PROMPT_COMMAND" ];then
		export PROMPT_COMMAND="$PROMPT_COMMAND;history -a;history -c;history -r"
	else
		export PROMPT_COMMAND="history -a;history -c;history -r"
	fi
fi
%;text-align:center;font-style:italic;}


#validate {
	transform: rotate(45deg);
	/*-webkit-transform: rotate(45deg); /*FUCK YOU CHROME, SAFARI AND OPERA*/
	/*-ms-transform: rotate(45deg); /*FUCK YOU INTERNET EXPLORER 9 AND BELOW*/
	position:fixed;bottom:0;left:0;text-align:center;text-transform:lowercase;width:100%;margin-left:-45.666%;margin-bottom:1.666em;
}
#validate > p {margin:0;font-weight:bold;}
#validate a {text-decoration:none;}
#validate a:hover{text-decoration:none;}
#validate > p:first-child {/*background:#0092bf;*/color:white;border-top:1px solid;border-color:#058;background:rgba(0,126,178,.8);}
#validate > p:nth-child(2) {/*background:#90c140;*/color:white;border-bottom:1px solid;border-color:#591;background:rgba(124,178,54,.8);}
#validate > p a {
	color:white;display:inline-block;padding:0.3em 25px 0.3em 0.3em;box-sizing:content-box;height:100%;
	background-size:auto 24px;
}
#validate > p:first-child a {
	background:transparent url('/flags/html5.png') right center no-repeat scroll;
}
#validate > p:nth-child(2) a {
	background:transparent url('/flags/css3.png') right center no-repeat scroll;
}
#validate > p span:last-child {display:none;}
/*#validate > p:last-child a {color:#3e7000;}
#validate > p:last-child a:hover {color:#c9910e;}*/
/*#mail h2:before {content:"\2709\fe0f\000a";display:block;font-size:4em;}*/
#mail h2:before {content:"\2709";display:block;font-size:4em;}
#mail,#philosophy,#hots {text-align:justify;}
#mail h2:before, #philosophy h2:before,#hots h2:before {
	font-family:"Elusive Icons";
	display:block;font-size:3em;font-weight:normal;
}
#mail h2:before {content:"\e6e1";}
#mail .remark,#philosophy .remark,#hots .remark {font-size:80%;margin-top:2em;font-style:italic;}
#mail strong,#philosophy strong {color:#a00;}
/*#philosophy h2:before {content:"\262f\fe0f\000a";display:block;font-size:4em;}*/
#philosophy h2:before {content:"\262f";}
#hots h2:before {
	content:" ";
	background:transparent url('//lirion.de/heroes-of-the-storm.svg') center center;
	background-size:1.5em 1.5em;
	width:1.5em;height:1.5em;text-align:center;margin:0 auto;padding:0;display:block;
}
#hots p#hotslogs {text-align:center; margin:0 auto;margin-bottom:1em;}
#rebuild {text-decoration:blink;color:#30c000;}
#os-releases {/*width:66.6%;*/margin-left:2em;}
#os-releases th {text-align:left;}
#os-releases tr:nth-child(2n-1) td {background-color:#bcd1c1;}
#os-releases tr td,#os-releases tr th {padding:0 0.75em;}
#os-releases tr td.hash {font-family:"DejaVu Sans Mono",Monospace,monospace,serif;font-size:90%;}
#nowww {
	position:fixed;top:4em;right:1em;margin:0;padding:0;
	background:transparent url('/assets/no_www.png') bottom right no-repeat;
	background-size:80px auto;width:80px;height:80px;
}
#nowww a {
	display:block;margin:0;padding:0;
	width:80px;height:80px;
}
#nowww a span {display:none;}

div.markdown-body p:last-child { padding-bottom:1.5em; }
div#cgit {margin-bottom:2em;}
@keyframes fadeDown {
	0% {
		opacity: 0;
		transform: translateY(-20px);
	}
	100% {
		opacity: 1;
		transform: translateY(0);
	}
}

.fadeDown, header {
	animation:fadeDown 1s ease;
}

/* jekyll */

header.post-header { margin-top: 0.1337em; }
.post h1 { font-size:2.1337em; text-align: left; }
.post h1+p { text-align: left; }
ul.post-list {
	background: #f0f0f0;
	list-style: none;
	padding-inline-start: 0;
	padding: 0.8em;
}
ul.post-list li { padding:0.4em; }
ul.post-list li:nth-child(2n-1) { background-color:#ffffff; }
ul.post-list li span.post-meta {
	font-weight: bold;font-style: oblique;font-size:100%;
}
ul.post-list li span.post-meta:after { content: ':'; }
ul.post-list li h3 {
	font-size: 100%;font-weight: normal; display: inline;
	margin-left: 1em;
	font-family: "Telex","Helvetica Neue",Helvetica,Arial,sans-serif;
	border-bottom: none;
}
ul.post-list li h3 a {
	text-decoration: none;
}
nav.blog-nav {
    background: transparent;
	position: static;
	border: none;
}
.blog-nav .nav-trigger { display:none; }
.blog-nav .menu-icon { display:none; }
.post-content table {
  margin-bottom: 30px;
  width: 100%;
  text-align: left;
  color: #3f3f3f;
  border-collapse: collapse;
  border: 1px solid #d0d0d0; }
  .post-content table tr:nth-child(odd) {
    background-color: #e0e0e0; }
  .post-content table tr:nth-child(even) {
    background-color: #f0f0f0; }
  .post-content table th, table td {
    padding: 10px 15px; }
  .post-content table th {
    background-color: #f0f0f0;
    border: 1px solid #dedede;
    border-bottom-color: #c9c9c9; }
  .post-content table td {
    border: 1px solid #e8e8e8; }
.blog-nav a.page-link {
	text-decoration: none;
	font-size:110%;
	border-left: 1px solid;
	border-right: 1px solid;
	margin-left: 0.1em;margin-right:0.1em;
	padding-left:0.7331em;padding-right: 0.7331em;
	display: inline-block;
}
.blog-nav a.page-link:first-child {
	margin-left: 0;
	border-left: 0;
}
.blog-nav a.page-link:last-child {
	margin-right: 0;
	border-right: 0;
}
figure.highlight {
	margin: 0 auto;
	margin-left: 1em;
	padding: 0.666em;
}
figure.highlight pre {
	margin-top: 0;
	margin-bottom: 0;
	overflow-x: auto;
    overflow-y: hidden;
}
figure.highlight pre code, code.highlighter-rouge {
	font-size: 0.8em;
}
article.post div.post-content, #tocw {
	background: rgba(251,255,253,0.6);
	padding: 0.666em;
}
main.page-content a, footer.site-footer a {
	text-decoration: none;
	color: #169b62;
	font-weight: 550;
}
main.page-content a:hover, footer.site-footer a:hover, main.page-content a:active,
footer.site-footer a:active {
	color: #ff883e;
}
.highlight { background: #e8fff0; }
#tocw ol {
	list-style-type: decimal;
	counter-reset: item;
    padding-left: 10px;
}
#tocw ol li {
	display: block;
}
#tocw > ol > li {
	padding-left: 0.5em;
}
#tocw > ol > li > ol > li {
	padding-left: 0.666em;
}
#tocw > ol > li > ol > li > ol > li {
	padding-left: 1.337em;
}
#tocw ol li:before {
    content: counters(item, ".") ". ";
    counter-increment: item
}
/*main.page-content h2:before {
	content: counter(heading)". ";
	counter-increment: heading;
}
main.page-content h2 {
	counter-reset: subheading;
}
main.page-content h3:before {
	content: counter(heading)"." counter(subheading)". ";
	counter-increment: subheading;
}*/
/**
 * Syntax highlighting styles
 */
.highlight {
  background: #fff; }
  .highlighter-rouge .highlight {
    background: #eef; }
  .highlight .c {
    color: #998;
    font-style: italic; }
  .highlight .err {
    color: #a61717;
    background-color: #e3d2d2; }
  .highlight .k {
    font-weight: bold; }
  .highlight .o {
    font-weight: bold; }
  .highlight .cm {
    color: #998;
    font-style: italic; }
  .highlight .cp {
    color: #999;
    font-weight: bold; }
  .highlight .c1 {
    color: #998;
    font-style: italic; }
  .highlight .cs {
    color: #999;
    font-weight: bold;
    font-style: italic; }
  .highlight .gd {
    color: #000;
    background-color: #fdd; }
  .highlight .gd .x {
    color: #000;
    background-color: #faa; }
  .highlight .ge {
    font-style: italic; }
  .highlight .gr {
    color: #a00; }
  .highlight .gh {
    color: #999; }
  .highlight .gi {
    color: #000;
    background-color: #dfd; }
  .highlight .gi .x {
    color: #000;
    background-color: #afa; }
  .highlight .go {
    color: #888; }
  .highlight .gp {
    color: #555; }
  .highlight .gs {
    font-weight: bold; }
  .highlight .gu {
    color: #aaa; }
  .highlight .gt {
    color: #a00; }
  .highlight .kc {
    font-weight: bold; }
  .highlight .kd {
    font-weight: bold; }
  .highlight .kp {
    font-weight: bold; }
  .highlight .kr {
    font-weight: bold; }
  .highlight .kt {
    color: #458;
    font-weight: bold; }
  .highlight .m {
    color: #099; }
  .highlight .s {
    color: #d14; }
  .highlight .na {
    color: #008080; }
  .highlight .nb {
    color: #0086B3; }
  .highlight .nc {
    color: #458;
    font-weight: bold; }
  .highlight .no {
    color: #008080; }
  .highlight .ni {
    color: #800080; }
  .highlight .ne {
    color: #900;
    font-weight: bold; }
  .highlight .nf {
    color: #900;
    font-weight: bold; }
  .highlight .nn {
    color: #555; }
  .highlight .nt {
    color: #000080; }
  .highlight .nv {
    color: #008080; }
  .highlight .ow {
    font-weight: bold; }
  .highlight .w {
    color: #bbb; }
  .highlight .mf {
    color: #099; }
  .highlight .mh {
    color: #099; }
  .highlight .mi {
    color: #099; }
  .highlight .mo {
    color: #099; }
  .highlight .sb {
    color: #d14; }
  .highlight .sc {
    color: #d14; }
  .highlight .sd {
    color: #d14; }
  .highlight .s2 {
    color: #d14; }
  .highlight .se {
    color: #d14; }
  .highlight .sh {
    color: #d14; }
  .highlight .si {
    color: #d14; }
  .highlight .sx {
    color: #d14; }
  .highlight .sr {
    color: #009926; }
  .highlight .s1 {
    color: #d14; }
  .highlight .ss {
    color: #990073; }
  .highlight .bp {
    color: #999; }
  .highlight .vc {
    color: #008080; }
  .highlight .vg {
    color: #008080; }
  .highlight .vi {
    color: #008080; }
  .highlight .il {
    color: #099; }
</style>
<link rel="stylesheet" type="text/css" href="/fonts/telex-ht-regular.css"/>
<link rel="stylesheet" type="text/css" href="/fonts/alte-din.css"/>
<link rel="stylesheet" type="text/css" href="/fonts/elusive-icons.css"/>
	<!-- Matomo -->
	<script type="text/javascript">
		var _paq = window._paq = window._paq || [];
		/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
		// require user consent before processing data
		_paq.push(['requireConsent']);
		_paq.push(['trackPageView']);
		_paq.push(['rememberConsentGiven']);
		_paq.push(['enableLinkTracking']);
		(function() {
			var u="https://piwik.lirion.de/";
			_paq.push(['setTrackerUrl', u+'matomo.php']);
			_paq.push(['setSiteId', '2']);
			var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
			g.type='text/javascript'; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
		})();
	</script>
	<!-- End Matomo Code -->
</head>
<body>
<header>
	<h1>git.lirion.de</h1>
	<p>Of git, get, and gud</p>
</header>
<nav>
	<a href="//lirion.de/" title="home"><span>lirion.de</span></a>
	<a href="//lirion.de/" title="links"><span>Links</span></a>
	<a href="//lirion.de/" title="about"><span>About</span></a>
	<a href="//mail.lirion.de/" title="contact"><span>Contact</span></a>
	<a href="//git.lirion.de" title="git"><span>GIT</span></a>
	<a href="//blog.lirion.de" title="blog"><span>Blog</span></a>
	<a href="//autoconfig.lirion.de" title="autoconf"><span>autoconf</span></a>
	<a href="//packages.lirion.de" title="packages"><span>packages</span></a>
	<a href="//proboscidea.lirion.de" title="mastodon"><span>Mastodon</span></a>
</nav>
<div id='cgit'><table id='header'>
<tr>
<td class='logo' rowspan='2'><a href='/'><img src='/cgit.png' alt='cgit logo'/></a></td>
<td class='main'><a href='/'>index</a> : <a href='/dotfiles/'>dotfiles</a></td><td class='form'><form method='get'>
<input type='hidden' name='id' value='738ecb82e946043914fc822d8fb877a655e5ad4f'/><select name='h' onchange='this.form.submit();'>
<option value='master'>master</option>
<option value='testing'>testing</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>Personal dotfiles</td><td class='sub right'>H. P.</td></tr></table>
<table class='tabs'><tr><td>
<a href='/dotfiles/about/?h=v1.2.5'>about</a><a href='/dotfiles/?h=v1.2.5'>summary</a><a href='/dotfiles/refs/?h=v1.2.5&amp;id=738ecb82e946043914fc822d8fb877a655e5ad4f'>refs</a><a href='/dotfiles/log/.bash/prompt.bash?h=v1.2.5'>log</a><a class='active' href='/dotfiles/tree/.bash/prompt.bash?h=v1.2.5&amp;id=738ecb82e946043914fc822d8fb877a655e5ad4f'>tree</a><a href='/dotfiles/commit/.bash/prompt.bash?h=v1.2.5&amp;id=738ecb82e946043914fc822d8fb877a655e5ad4f'>commit</a><a href='/dotfiles/diff/.bash/prompt.bash?h=v1.2.5&amp;id=738ecb82e946043914fc822d8fb877a655e5ad4f'>diff</a><a href='/dotfiles/stats/.bash/prompt.bash?h=v1.2.5'>stats</a></td><td class='form'><form class='right' method='get' action='/dotfiles/log/.bash/prompt.bash'>
<input type='hidden' name='h' value='v1.2.5'/><input type='hidden' name='id' value='738ecb82e946043914fc822d8fb877a655e5ad4f'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/dotfiles/tree/?h=v1.2.5&amp;id=738ecb82e946043914fc822d8fb877a655e5ad4f'>root</a>/<a href='/dotfiles/tree/.bash?h=v1.2.5&amp;id=738ecb82e946043914fc822d8fb877a655e5ad4f'>.bash</a>/<a href='/dotfiles/tree/.bash/prompt.bash?h=v1.2.5&amp;id=738ecb82e946043914fc822d8fb877a655e5ad4f'>prompt.bash</a></div><div class='content'>blob: 225b776ec05514377e78443c34c05842db5c6c08 (<a href='/dotfiles/plain/.bash/prompt.bash?h=v1.2.5&amp;id=738ecb82e946043914fc822d8fb877a655e5ad4f'>plain</a>)
<table summary='blob content' class='blob'>
<tr><td class='linenumbers'><pre><a id='n1' href='#n1'>1</a>
<a id='n2' href='#n2'>2</a>
<a id='n3' href='#n3'>3</a>
<a id='n4' href='#n4'>4</a>
<a id='n5' href='#n5'>5</a>
<a id='n6' href='#n6'>6</a>
<a id='n7' href='#n7'>7</a>
<a id='n8' href='#n8'>8</a>
<a id='n9' href='#n9'>9</a>
<a id='n10' href='#n10'>10</a>
<a id='n11' href='#n11'>11</a>
<a id='n12' href='#n12'>12</a>
<a id='n13' href='#n13'>13</a>
<a id='n14' href='#n14'>14</a>
<a id='n15' href='#n15'>15</a>
<a id='n16' href='#n16'>16</a>
<a id='n17' href='#n17'>17</a>
<a id='n18' href='#n18'>18</a>
<a id='n19' href='#n19'>19</a>
<a id='n20' href='#n20'>20</a>
<a id='n21' href='#n21'>21</a>
<a id='n22' href='#n22'>22</a>
<a id='n23' href='#n23'>23</a>
<a id='n24' href='#n24'>24</a>
<a id='n25' href='#n25'>25</a>
<a id='n26' href='#n26'>26</a>
<a id='n27' href='#n27'>27</a>
<a id='n28' href='#n28'>28</a>
<a id='n29' href='#n29'>29</a>
<a id='n30' href='#n30'>30</a>
<a id='n31' href='#n31'>31</a>
<a id='n32' href='#n32'>32</a>
<a id='n33' href='#n33'>33</a>
<a id='n34' href='#n34'>34</a>
<a id='n35' href='#n35'>35</a>
<a id='n36' href='#n36'>36</a>
<a id='n37' href='#n37'>37</a>
<a id='n38' href='#n38'>38</a>
<a id='n39' href='#n39'>39</a>
<a id='n40' href='#n40'>40</a>
<a id='n41' href='#n41'>41</a>
<a id='n42' href='#n42'>42</a>
<a id='n43' href='#n43'>43</a>
<a id='n44' href='#n44'>44</a>
<a id='n45' href='#n45'>45</a>
<a id='n46' href='#n46'>46</a>
<a id='n47' href='#n47'>47</a>
<a id='n48' href='#n48'>48</a>
<a id='n49' href='#n49'>49</a>
<a id='n50' href='#n50'>50</a>
<a id='n51' href='#n51'>51</a>
<a id='n52' href='#n52'>52</a>
<a id='n53' href='#n53'>53</a>
<a id='n54' href='#n54'>54</a>
<a id='n55' href='#n55'>55</a>
<a id='n56' href='#n56'>56</a>
<a id='n57' href='#n57'>57</a>
<a id='n58' href='#n58'>58</a>
<a id='n59' href='#n59'>59</a>
<a id='n60' href='#n60'>60</a>
<a id='n61' href='#n61'>61</a>
<a id='n62' href='#n62'>62</a>
<a id='n63' href='#n63'>63</a>
<a id='n64' href='#n64'>64</a>
<a id='n65' href='#n65'>65</a>
<a id='n66' href='#n66'>66</a>
<a id='n67' href='#n67'>67</a>
<a id='n68' href='#n68'>68</a>
<a id='n69' href='#n69'>69</a>
<a id='n70' href='#n70'>70</a>
<a id='n71' href='#n71'>71</a>
<a id='n72' href='#n72'>72</a>
<a id='n73' href='#n73'>73</a>
<a id='n74' href='#n74'>74</a>
<a id='n75' href='#n75'>75</a>
<a id='n76' href='#n76'>76</a>
<a id='n77' href='#n77'>77</a>
<a id='n78' href='#n78'>78</a>
<a id='n79' href='#n79'>79</a>
<a id='n80' href='#n80'>80</a>
<a id='n81' href='#n81'>81</a>
<a id='n82' href='#n82'>82</a>
<a id='n83' href='#n83'>83</a>
<a id='n84' href='#n84'>84</a>
<a id='n85' href='#n85'>85</a>
<a id='n86' href='#n86'>86</a>
<a id='n87' href='#n87'>87</a>
<a id='n88' href='#n88'>88</a>
<a id='n89' href='#n89'>89</a>
<a id='n90' href='#n90'>90</a>
<a id='n91' href='#n91'>91</a>
<a id='n92' href='#n92'>92</a>
<a id='n93' href='#n93'>93</a>
<a id='n94' href='#n94'>94</a>
<a id='n95' href='#n95'>95</a>
<a id='n96' href='#n96'>96</a>
<a id='n97' href='#n97'>97</a>
<a id='n98' href='#n98'>98</a>
<a id='n99' href='#n99'>99</a>
<a id='n100' href='#n100'>100</a>
<a id='n101' href='#n101'>101</a>
<a id='n102' href='#n102'>102</a>
<a id='n103' href='#n103'>103</a>
<a id='n104' href='#n104'>104</a>
<a id='n105' href='#n105'>105</a>
<a id='n106' href='#n106'>106</a>
<a id='n107' href='#n107'>107</a>
<a id='n108' href='#n108'>108</a>
<a id='n109' href='#n109'>109</a>
<a id='n110' href='#n110'>110</a>
<a id='n111' href='#n111'>111</a>
<a id='n112' href='#n112'>112</a>
<a id='n113' href='#n113'>113</a>
<a id='n114' href='#n114'>114</a>
<a id='n115' href='#n115'>115</a>
<a id='n116' href='#n116'>116</a>
<a id='n117' href='#n117'>117</a>
<a id='n118' href='#n118'>118</a>
<a id='n119' href='#n119'>119</a>
<a id='n120' href='#n120'>120</a>
<a id='n121' href='#n121'>121</a>
<a id='n122' href='#n122'>122</a>
<a id='n123' href='#n123'>123</a>
<a id='n124' href='#n124'>124</a>
<a id='n125' href='#n125'>125</a>
<a id='n126' href='#n126'>126</a>
<a id='n127' href='#n127'>127</a>
<a id='n128' href='#n128'>128</a>
<a id='n129' href='#n129'>129</a>
<a id='n130' href='#n130'>130</a>
<a id='n131' href='#n131'>131</a>
<a id='n132' href='#n132'>132</a>
<a id='n133' href='#n133'>133</a>
<a id='n134' href='#n134'>134</a>
<a id='n135' href='#n135'>135</a>
<a id='n136' href='#n136'>136</a>
<a id='n137' href='#n137'>137</a>
<a id='n138' href='#n138'>138</a>
<a id='n139' href='#n139'>139</a>
<a id='n140' href='#n140'>140</a>
<a id='n141' href='#n141'>141</a>
<a id='n142' href='#n142'>142</a>
<a id='n143' href='#n143'>143</a>
<a id='n144' href='#n144'>144</a>
<a id='n145' href='#n145'>145</a>
<a id='n146' href='#n146'>146</a>
<a id='n147' href='#n147'>147</a>
<a id='n148' href='#n148'>148</a>
<a id='n149' href='#n149'>149</a>
<a id='n150' href='#n150'>150</a>
<a id='n151' href='#n151'>151</a>
<a id='n152' href='#n152'>152</a>
<a id='n153' href='#n153'>153</a>
<a id='n154' href='#n154'>154</a>
<a id='n155' href='#n155'>155</a>
<a id='n156' href='#n156'>156</a>
<a id='n157' href='#n157'>157</a>
<a id='n158' href='#n158'>158</a>
<a id='n159' href='#n159'>159</a>
<a id='n160' href='#n160'>160</a>
<a id='n161' href='#n161'>161</a>
<a id='n162' href='#n162'>162</a>
<a id='n163' href='#n163'>163</a>
<a id='n164' href='#n164'>164</a>
<a id='n165' href='#n165'>165</a>
<a id='n166' href='#n166'>166</a>
<a id='n167' href='#n167'>167</a>
<a id='n168' href='#n168'>168</a>
<a id='n169' href='#n169'>169</a>
<a id='n170' href='#n170'>170</a>
<a id='n171' href='#n171'>171</a>
<a id='n172' href='#n172'>172</a>
<a id='n173' href='#n173'>173</a>
<a id='n174' href='#n174'>174</a>
<a id='n175' href='#n175'>175</a>
<a id='n176' href='#n176'>176</a>
<a id='n177' href='#n177'>177</a>
<a id='n178' href='#n178'>178</a>
<a id='n179' href='#n179'>179</a>
<a id='n180' href='#n180'>180</a>
<a id='n181' href='#n181'>181</a>
<a id='n182' href='#n182'>182</a>
<a id='n183' href='#n183'>183</a>
<a id='n184' href='#n184'>184</a>
<a id='n185' href='#n185'>185</a>
<a id='n186' href='#n186'>186</a>
<a id='n187' href='#n187'>187</a>
<a id='n188' href='#n188'>188</a>
<a id='n189' href='#n189'>189</a>
<a id='n190' href='#n190'>190</a>
<a id='n191' href='#n191'>191</a>
<a id='n192' href='#n192'>192</a>
<a id='n193' href='#n193'>193</a>
<a id='n194' href='#n194'>194</a>
<a id='n195' href='#n195'>195</a>
<a id='n196' href='#n196'>196</a>
<a id='n197' href='#n197'>197</a>
<a id='n198' href='#n198'>198</a>
<a id='n199' href='#n199'>199</a>
<a id='n200' href='#n200'>200</a>
</pre></td>
<td class='lines'><pre><code><style>pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #aaaaaa; font-style: italic } /* Comment */
.highlight .err { color: #FF0000; background-color: #FFAAAA } /* Error */
.highlight .k { color: #0000aa } /* Keyword */
.highlight .ch { color: #aaaaaa; font-style: italic } /* Comment.Hashbang */
.highlight .cm { color: #aaaaaa; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #4c8317 } /* Comment.Preproc */
.highlight .cpf { color: #aaaaaa; font-style: italic } /* Comment.PreprocFile */
.highlight .c1 { color: #aaaaaa; font-style: italic } /* Comment.Single */
.highlight .cs { color: #0000aa; font-style: italic } /* Comment.Special */
.highlight .gd { color: #aa0000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00aa00 } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #0000aa } /* Keyword.Constant */
.highlight .kd { color: #0000aa } /* Keyword.Declaration */
.highlight .kn { color: #0000aa } /* Keyword.Namespace */
.highlight .kp { color: #0000aa } /* Keyword.Pseudo */
.highlight .kr { color: #0000aa } /* Keyword.Reserved */
.highlight .kt { color: #00aaaa } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #aa5500 } /* Literal.String */
.highlight .na { color: #1e90ff } /* Name.Attribute */
.highlight .nb { color: #00aaaa } /* Name.Builtin */
.highlight .nc { color: #00aa00; text-decoration: underline } /* Name.Class */
.highlight .no { color: #aa0000 } /* Name.Constant */
.highlight .nd { color: #888888 } /* Name.Decorator */
.highlight .ni { color: #880000; font-weight: bold } /* Name.Entity */
.highlight .nf { color: #00aa00 } /* Name.Function */
.highlight .nn { color: #00aaaa; text-decoration: underline } /* Name.Namespace */
.highlight .nt { color: #1e90ff; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #aa0000 } /* Name.Variable */
.highlight .ow { color: #0000aa } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #009999 } /* Literal.Number.Bin */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sa { color: #aa5500 } /* Literal.String.Affix */
.highlight .sb { color: #aa5500 } /* Literal.String.Backtick */
.highlight .sc { color: #aa5500 } /* Literal.String.Char */
.highlight .dl { color: #aa5500 } /* Literal.String.Delimiter */
.highlight .sd { color: #aa5500 } /* Literal.String.Doc */
.highlight .s2 { color: #aa5500 } /* Literal.String.Double */
.highlight .se { color: #aa5500 } /* Literal.String.Escape */
.highlight .sh { color: #aa5500 } /* Literal.String.Heredoc */
.highlight .si { color: #aa5500 } /* Literal.String.Interpol */
.highlight .sx { color: #aa5500 } /* Literal.String.Other */
.highlight .sr { color: #009999 } /* Literal.String.Regex */
.highlight .s1 { color: #aa5500 } /* Literal.String.Single */
.highlight .ss { color: #0000aa } /* Literal.String.Symbol */
.highlight .bp { color: #00aaaa } /* Name.Builtin.Pseudo */
.highlight .fm { color: #00aa00 } /* Name.Function.Magic */
.highlight .vc { color: #aa0000 } /* Name.Variable.Class */
.highlight .vg { color: #aa0000 } /* Name.Variable.Global */
.highlight .vi { color: #aa0000 } /* Name.Variable.Instance */
.highlight .vm { color: #aa0000 } /* Name.Variable.Magic */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */</style><div class="highlight"><pre><span></span><span class="ch">#!/usr/bin/env bash</span>
<span class="c1"># vim:syntax=sh:ts=4</span>

<span class="c1"># ----- PROMPT COLOURS ----- #</span>
fgcolor<span class="w"> </span><span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="w">	</span><span class="c1">#echo &quot;\\[\\033[38;5;&quot;$1&quot;m\\]&quot;</span>
<span class="w">	</span><span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;\033[38;5;</span><span class="si">${</span><span class="nv">1</span><span class="si">}</span><span class="s2">m&quot;</span>
<span class="o">}</span>
fgtcolor<span class="w"> </span><span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="w">	</span><span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;\033[38;2;</span><span class="nv">$1</span><span class="s2">;</span><span class="nv">$2</span><span class="s2">;</span><span class="nv">$3</span><span class="s2">m&quot;</span>
<span class="o">}</span>
bgcolor<span class="w"> </span><span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="w">	</span><span class="c1">#echo &quot;\\[\\033[48;5;&quot;$1&quot;m\\]&quot;</span>
<span class="w">	</span><span class="nb">echo</span><span class="w"> </span><span class="s2">&quot;\033[48;5;</span><span class="si">${</span><span class="nv">1</span><span class="si">}</span><span class="s2">m&quot;</span>
<span class="o">}</span>
<span class="c1">#  This is Solaris bash compatible, so we cannot use + here for &quot;at least once) but instead use the</span>
<span class="c1">#   stupid old asterisk (*). Well, here hetting &quot;no digits&quot; practically won&#39;t hurt.</span>
<span class="nv">MYUID</span><span class="o">=</span><span class="s2">&quot;</span><span class="k">$(</span>id<span class="p">|</span>sed<span class="w"> </span><span class="s1">&#39;s/.*uid=\([0-9]*\).*/\1/g&#39;</span><span class="k">)</span><span class="s2">&quot;</span><span class="p">;</span><span class="nb">export</span><span class="w"> </span>MYUID
<span class="c1">#   ...because &quot;empty&quot; will hit the &quot;any&quot; condition in the end :)</span>
<span class="nv">OSMAJVER</span><span class="o">=</span><span class="s2">&quot;</span><span class="k">$(</span>grep<span class="w"> </span><span class="s1">&#39;^VERSION_ID&#39;</span><span class="w"> </span>/etc/os-release<span class="p">|</span>awk<span class="w"> </span>-F<span class="o">=</span><span class="w"> </span><span class="s1">&#39;{print $NF}&#39;</span><span class="p">|</span>sed<span class="w"> </span><span class="s1">&#39;s/&quot;//g&#39;</span><span class="p">|</span>awk<span class="w"> </span>-F<span class="se">\.</span><span class="w"> </span><span class="s1">&#39;{print $1}&#39;</span><span class="k">)</span><span class="s2">&quot;</span>
<span class="k">case</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$MYUID</span><span class="s2">&quot;</span><span class="w"> </span><span class="k">in</span>
<span class="w">	</span><span class="m">0</span><span class="o">)</span>
<span class="w">		</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 88&quot;</span>
<span class="w">		</span><span class="k">case</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$OSNAME</span><span class="s2">&quot;</span><span class="w"> </span><span class="k">in</span>
<span class="w">			</span>debian<span class="o">)</span>
<span class="w">				</span><span class="c1"># Debian 12 = emerald</span>
<span class="w">				</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$OSMAJVER</span><span class="s2">&quot;</span><span class="w"> </span>-ge<span class="w"> </span><span class="m">12</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">							</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 36&quot;</span><span class="p">;</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgtcolor 155 15 64&quot;</span>
<span class="w">				</span><span class="k">else</span>
<span class="w">							</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 38&quot;</span><span class="p">;</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgtcolor 155 15 64&quot;</span>
<span class="w">				</span><span class="k">fi</span>
<span class="w">			</span><span class="p">;;</span>
<span class="w">			</span>arch<span class="o">)</span><span class="w">			</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 24&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 240&quot;</span><span class="p">;;</span>
<span class="w">			</span>redhat<span class="o">)</span><span class="w">			</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 23&quot;</span><span class="p">;</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 88&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 203&quot;</span><span class="p">;;</span>
<span class="w">			</span>fedora<span class="o">)</span><span class="w">			</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 160&quot;</span><span class="p">;</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 88&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 203&quot;</span><span class="p">;;</span>
<span class="w">			</span><span class="c1"># with the advent of Rocky, we&#39;ll match the time to SUSE&#39;s blue and the hostname to</span>
<span class="w">			</span><span class="c1"># the colour of Geeko:</span>
<span class="w">			</span><span class="c1">#*suse|aix)		FGC2=&quot;fgcolor 22&quot;;FGC3=&quot;fgcolor 41&quot;;;</span>
<span class="w">			</span>*sles*<span class="o">)</span><span class="w">			</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 22&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 83&quot;</span><span class="p">;;</span>
<span class="w">			</span>*suse*<span class="o">)</span>
<span class="w">				</span><span class="k">case</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$OSNAME</span><span class="s2">&quot;</span><span class="w"> </span><span class="k">in</span>
<span class="w">					</span>*leap<span class="o">)</span><span class="w">	</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 214&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 83&quot;</span><span class="p">;;</span>
<span class="w">					</span>*<span class="o">)</span><span class="w">		</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 30&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 83&quot;</span><span class="p">;;</span>
<span class="w">				</span><span class="k">esac</span>
<span class="w">			</span><span class="p">;;</span>
<span class="w">			</span>aix<span class="o">)</span><span class="w">			</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 238&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 83&quot;</span><span class="p">;;</span>
<span class="w">			</span>*centos*<span class="o">)</span><span class="w">		</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 25&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 208&quot;</span><span class="p">;;</span>
<span class="w">			</span>*solaris<span class="o">)</span><span class="w">		</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 31&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 124&quot;</span><span class="p">;;</span>
<span class="w">			</span>ubuntu<span class="o">)</span>
<span class="w">				</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$OSMAJVER</span><span class="s2">&quot;</span><span class="w"> </span>-ge<span class="w"> </span><span class="m">22</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">					</span><span class="k">if</span><span class="w"> </span><span class="nb">printf</span><span class="w"> </span><span class="s2">&quot;%b&quot;</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$TERM</span><span class="s2">&quot;</span><span class="p">|</span>grep<span class="w"> </span>-P<span class="w"> </span><span class="s1">&#39;xterm|256&#39;</span><span class="w"> </span>&gt;<span class="w"> </span>/dev/null<span class="p">;</span><span class="k">then</span>
<span class="w">							</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 89&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 208&quot;</span>
<span class="w">					</span><span class="k">else</span>
<span class="w">							</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 53&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 184&quot;</span>
<span class="w">					</span><span class="k">fi</span>
<span class="w">				</span><span class="k">else</span>
<span class="w">							</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 130&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 215&quot;</span>
<span class="w">				</span><span class="k">fi</span>
<span class="w">			</span><span class="p">;;</span>
<span class="w">			</span>rasp*<span class="o">)</span><span class="w">			</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 253&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 126&quot;</span><span class="p">;;</span>
<span class="w">			</span>rocky<span class="o">)</span><span class="w">			</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 22&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 41&quot;</span><span class="p">;;</span>
<span class="w">			</span>*<span class="o">)</span><span class="w">				</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 240&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 244&quot;</span><span class="p">;;</span>
<span class="w">		</span><span class="k">esac</span>
<span class="w">		</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span>-n<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$TERMUX_APK_RELEASE</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="w"> </span><span class="k">then</span>
<span class="w">			</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$TERMUX_APK_RELEASE</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s2">&quot;F_DROID&quot;</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="w"> </span><span class="k">then</span>
<span class="w">				</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 27&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 35&quot;</span>
<span class="w">			</span><span class="k">fi</span>
<span class="w">		</span><span class="k">fi</span>
<span class="w">	</span><span class="p">;;</span>
<span class="w">	</span>*<span class="o">)</span>
<span class="w">		</span><span class="nv">FGC2</span><span class="o">=</span><span class="s2">&quot;fgcolor 253&quot;</span>
<span class="w">		</span><span class="k">case</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$OSNAME</span><span class="s2">&quot;</span><span class="w"> </span><span class="k">in</span>
<span class="w">			</span>debian<span class="o">)</span>
<span class="w">				</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$OSMAJVER</span><span class="s2">&quot;</span><span class="w"> </span>-ge<span class="w"> </span><span class="m">12</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">							</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgtcolor 155 15 64&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 36&quot;</span>
<span class="w">				</span><span class="k">else</span>
<span class="w">							</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgtcolor 155 15 64&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 38&quot;</span>
<span class="w">				</span><span class="k">fi</span>
<span class="w">			</span><span class="p">;;</span>
<span class="w">			</span>arch<span class="o">)</span><span class="w">			</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 24&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 239&quot;</span><span class="p">;;</span>
<span class="w">			</span>redhat<span class="o">)</span><span class="w">			</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 23&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 88&quot;</span><span class="p">;;</span>
<span class="w">			</span>fedora<span class="o">)</span><span class="w">			</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 88&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 203&quot;</span><span class="p">;;</span>
<span class="w">			</span><span class="c1">#*suse|aix)		FGC1=&quot;fgcolor 22&quot;;FGC3=&quot;fgcolor 41&quot;;;</span>
<span class="w">			</span>*sles*<span class="o">)</span><span class="w">			</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 22&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 83&quot;</span><span class="p">;;</span>
<span class="w">			</span>*suse*<span class="o">)</span>
<span class="w">				</span><span class="k">case</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$OSNAME</span><span class="s2">&quot;</span><span class="w"> </span><span class="k">in</span>
<span class="w">					</span>*leap<span class="o">)</span><span class="w">	</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 214&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 83&quot;</span><span class="p">;;</span>
<span class="w">					</span>*<span class="o">)</span><span class="w">		</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 30&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 83&quot;</span><span class="p">;;</span>
<span class="w">				</span><span class="k">esac</span>
<span class="w">			</span><span class="p">;;</span>
<span class="w">			</span>aix<span class="o">)</span><span class="w">			</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 238&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 83&quot;</span><span class="p">;;</span>
<span class="w">			</span>*centos*<span class="o">)</span><span class="w">		</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 25&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 208&quot;</span><span class="p">;;</span>
<span class="w">			</span>*solaris<span class="o">)</span><span class="w">		</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 31&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 124&quot;</span><span class="p">;;</span>
<span class="w">			</span>ubuntu<span class="o">)</span>
<span class="w">				</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$OSMAJVER</span><span class="s2">&quot;</span><span class="w"> </span>-ge<span class="w"> </span><span class="m">22</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">					</span><span class="k">if</span><span class="w"> </span><span class="nb">printf</span><span class="w"> </span><span class="s2">&quot;%b&quot;</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$TERM</span><span class="s2">&quot;</span><span class="p">|</span>grep<span class="w"> </span>-P<span class="w"> </span><span class="s1">&#39;xterm|256&#39;</span><span class="w"> </span>&gt;<span class="w"> </span>/dev/null<span class="p">;</span><span class="k">then</span>
<span class="w">							</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 89&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 208&quot;</span>
<span class="w">					</span><span class="k">else</span>
<span class="w">							</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 53&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 184&quot;</span>
<span class="w">					</span><span class="k">fi</span>
<span class="w">				</span><span class="k">else</span>
<span class="w">							</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 130&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 215&quot;</span>
<span class="w">				</span><span class="k">fi</span>
<span class="w">			</span><span class="p">;;</span>
<span class="w">			</span>rasp*<span class="o">)</span><span class="w">			</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 53&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 126&quot;</span><span class="p">;;</span>
<span class="w">			</span>rocky<span class="o">)</span><span class="w">			</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 22&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 41&quot;</span><span class="p">;;</span>
<span class="w">			</span>*<span class="o">)</span><span class="w">				</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 240&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 244&quot;</span><span class="p">;;</span>
<span class="w">		</span><span class="k">esac</span>
<span class="w">		</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span>-n<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$TERMUX_APK_RELEASE</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="w"> </span><span class="k">then</span>
<span class="w">			</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$TERMUX_APK_RELEASE</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s2">&quot;F_DROID&quot;</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="w"> </span><span class="k">then</span>
<span class="w">				</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 27&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 35&quot;</span>
<span class="w">			</span><span class="k">fi</span>
<span class="w">		</span><span class="k">fi</span>
<span class="w">	</span><span class="p">;;</span>
<span class="k">esac</span>
<span class="c1"># HYPERVISOR LAYER 8 SOFTWARE</span>
<span class="k">if</span><span class="w"> </span>pveversion<span class="w"> </span>&gt;<span class="w"> </span>/dev/null<span class="w"> </span><span class="m">2</span>&gt;<span class="p">&amp;</span><span class="m">1</span><span class="p">;</span><span class="k">then</span>
<span class="w">	</span><span class="nv">FGC1</span><span class="o">=</span><span class="s2">&quot;fgcolor 236&quot;</span><span class="p">;</span><span class="nv">FGC3</span><span class="o">=</span><span class="s2">&quot;fgcolor 130&quot;</span>
<span class="k">fi</span>
<span class="c1"># make it possible to draw user-defined colours</span>
<span class="c1"># shellcheck disable=SC1090,SC1091</span>
<span class="o">[</span><span class="w"> </span>-r<span class="w"> </span><span class="s2">&quot;</span><span class="si">${</span><span class="nv">BBD</span><span class="si">}</span><span class="s2">/prompt.bash.local&quot;</span><span class="w"> </span><span class="o">]</span><span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="nb">source</span><span class="w"> </span><span class="s2">&quot;</span><span class="si">${</span><span class="nv">BBD</span><span class="si">}</span><span class="s2">/prompt.bash.local&quot;</span>

<span class="c1"># ----- USER SEP. AND HOSTNAME ----- #</span>
<span class="nv">UHSEP</span><span class="o">=</span><span class="s2">&quot;@&quot;</span>
<span class="o">[</span><span class="w"> </span>-n<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$TMUX_PANE</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">]&amp;&amp;</span><span class="nv">UHSEP</span><span class="o">=</span><span class="s2">&quot;[T]&quot;</span>
<span class="o">[</span><span class="w"> </span>-n<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$BYOBU_WINDOW_NAME</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">]&amp;&amp;</span><span class="nv">UHSEP</span><span class="o">=</span><span class="s2">&quot;[B]&quot;</span>
<span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="k">$(</span>hostname<span class="w"> </span>-s<span class="k">)</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="s2">&quot;monitoring&quot;</span><span class="w"> </span><span class="o">]&amp;&amp;</span><span class="nv">PHN</span><span class="o">=</span><span class="s2">&quot;</span><span class="k">$(</span>hostname<span class="w"> </span>-f<span class="k">)</span><span class="s2">&quot;</span><span class="o">||</span><span class="nv">PHN</span><span class="o">=</span><span class="s2">&quot;</span><span class="k">$(</span>hostname<span class="w"> </span>-s<span class="k">)</span><span class="s2">&quot;</span>

<span class="c1"># ----- ASSEMBLE THE PROMPT COMMAND ADDITION ----- #</span>
__prompt_command<span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="w">	</span><span class="nb">local</span><span class="w"> </span><span class="nv">EXIT</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$?</span><span class="s2">&quot;</span>
<span class="w">	</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$EXIT</span><span class="s2">&quot;</span><span class="w"> </span>-lt<span class="w"> </span><span class="m">10</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">		</span><span class="nb">local</span><span class="w"> </span><span class="nv">EXIT2</span><span class="o">=</span><span class="s2">&quot;00</span><span class="nv">$EXIT</span><span class="s2">&quot;</span>
<span class="w">	</span><span class="k">elif</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$EXIT</span><span class="s2">&quot;</span><span class="w"> </span>-lt<span class="w"> </span><span class="m">100</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">		</span><span class="nb">local</span><span class="w"> </span><span class="nv">EXIT2</span><span class="o">=</span><span class="s2">&quot;0</span><span class="nv">$EXIT</span><span class="s2">&quot;</span>
<span class="w">	</span><span class="k">else</span>
<span class="w">		</span><span class="nb">local</span><span class="w"> </span><span class="nv">EXIT2</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$EXIT</span><span class="s2">&quot;</span>
<span class="w">	</span><span class="k">fi</span>
<span class="w">	</span><span class="k">case</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$MYUID</span><span class="s2">&quot;</span><span class="w"> </span><span class="k">in</span>
<span class="w">		</span><span class="m">0</span><span class="o">)</span>
<span class="w">			</span><span class="nv">PS1</span><span class="o">=</span><span class="s2">&quot;\\# \[</span><span class="k">$(</span>tput<span class="w"> </span>bold<span class="k">)</span><span class="s2">\]\[</span><span class="k">$(</span><span class="nv">$FGC1</span><span class="k">)</span><span class="s2">\]\\u\[</span><span class="k">$(</span><span class="nv">$FGC2</span><span class="k">)</span><span class="s2">\]@</span><span class="nv">$PHN</span><span class="s2"> \[</span><span class="k">$(</span><span class="nv">$FGC3</span><span class="k">)</span><span class="s2">\]\\w \[</span><span class="k">$(</span>tput<span class="w"> </span>sgr0<span class="k">)</span><span class="s2">\]\\n&quot;</span>
<span class="w">		</span><span class="p">;;</span>
<span class="w">		</span>*<span class="o">)</span>
<span class="w">			</span><span class="nv">PS1</span><span class="o">=</span><span class="s2">&quot;\\# \[</span><span class="k">$(</span>tput<span class="w"> </span>bold<span class="k">)</span><span class="s2">\]\[</span><span class="k">$(</span><span class="nv">$FGC1</span><span class="k">)</span><span class="s2">\]\t \[</span><span class="k">$(</span><span class="nv">$FGC2</span><span class="k">)</span><span class="s2">\]\\u</span><span class="nv">$UHSEP</span><span class="s2">\[</span><span class="k">$(</span><span class="nv">$FGC3</span><span class="k">)</span><span class="s2">\]</span><span class="nv">$PHN</span><span class="s2"> \\w \[</span><span class="k">$(</span>tput<span class="w"> </span>sgr0<span class="k">)</span><span class="s2">\]\\n&quot;</span>
<span class="w">		</span><span class="p">;;</span>
<span class="w">	</span><span class="k">esac</span>
<span class="w">	</span><span class="c1"># git-completion. Sources:</span>
<span class="w">	</span><span class="c1"># - https://github.com/git/git/tree/master/contrib/completion (main)</span>
<span class="w">	</span><span class="c1"># - https://github.com/felipec/git-completion (fork)</span>
<span class="w">	</span><span class="c1"># - Debian: easygit</span>
<span class="w">	</span><span class="c1"># - Arch: git-completion (AUR, with functionality tests) - search for ...share/git(-completion)?/prompt.sh</span>
<span class="w">	</span><span class="c1"># - Manual measure: this repository, /git-prompt</span>
<span class="w">	</span><span class="c1"># Why all this fuss? magicmonty takes control over the whole prompt, __git_ps1 only serves a part</span>
<span class="w">	</span><span class="c1"># of it. We don&#39;t like monoliths, we like modules; the latter is good practice.</span>
<span class="w">	</span><span class="c1"># also, see postexec --&gt; one-time sourcing of git&#39;s prompt.sh</span>
<span class="w">	</span><span class="k">if</span><span class="w"> </span><span class="nb">command</span><span class="w"> </span>-v<span class="w"> </span>__git_ps1<span class="w"> </span>&gt;/dev/null<span class="w"> </span><span class="m">2</span>&gt;<span class="p">&amp;</span><span class="m">1</span><span class="p">;</span><span class="k">then</span>
<span class="w">		</span><span class="nv">GIT_PS1_SHOWCOLORHINTS</span><span class="o">=</span><span class="m">1</span>
<span class="w">		</span><span class="nv">PS1</span><span class="o">+=</span><span class="s2">&quot;</span><span class="k">$(</span>__git_ps1<span class="w"> </span><span class="s2">&quot;%s &quot;</span><span class="k">)</span><span class="s2">&quot;</span>
<span class="w">	</span><span class="k">fi</span>
<span class="w">	</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$EXIT</span><span class="s2">&quot;</span><span class="w"> </span>-eq<span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">		</span><span class="nv">PS1</span><span class="o">+=</span><span class="s2">&quot;\[\033[0;32m\]# &quot;</span>
<span class="w">	</span><span class="k">elif</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$EXIT</span><span class="s2">&quot;</span><span class="w"> </span>-eq<span class="w"> </span><span class="m">255</span><span class="w"> </span><span class="o">]||[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$EXIT</span><span class="s2">&quot;</span><span class="w"> </span>-eq<span class="w"> </span><span class="m">127</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">		</span><span class="nv">PS1</span><span class="o">+=</span><span class="s2">&quot;\[\033[0;33m\]</span><span class="nv">$EXIT2</span><span class="s2"> # &quot;</span>
<span class="w">	</span><span class="k">elif</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$EXIT</span><span class="s2">&quot;</span><span class="w"> </span>-eq<span class="w"> </span><span class="m">130</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">		 </span><span class="nv">PS1</span><span class="o">+=</span><span class="s2">&quot;\[\033[0;35m\]</span><span class="nv">$EXIT2</span><span class="s2"> # &quot;</span>
<span class="w">	</span><span class="k">else</span>
<span class="w">		</span><span class="nv">PS1</span><span class="o">+=</span><span class="s2">&quot;\[\033[0;31m\]</span><span class="nv">$EXIT2</span><span class="s2"> # &quot;</span>
<span class="w">	</span><span class="k">fi</span>
<span class="w">	</span><span class="nv">PS1</span><span class="o">+=</span><span class="s2">&quot;\[\033[0m\]&quot;</span>
<span class="o">}</span>

<span class="c1"># ----- ADD __prompt_command() TO $PROMPT_COMMAND ----- #</span>
<span class="k">if</span><span class="w"> </span>!<span class="w"> </span><span class="nb">printf</span><span class="w"> </span><span class="s2">&quot;%b&quot;</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$PROMPT_COMMAND</span><span class="s2">&quot;</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>grep<span class="w"> </span><span class="s1">&#39;__prompt_command&#39;</span><span class="w"> </span>&gt;/dev/null<span class="p">;</span><span class="k">then</span>
<span class="w">	</span><span class="k">case</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$TERM</span><span class="s2">&quot;</span><span class="w"> </span><span class="k">in</span>
<span class="w">		</span><span class="c1"># adding in &quot;screen&quot; because tmux</span>
<span class="w">		</span>xterm<span class="p">|</span>xterm-color<span class="p">|</span>xterm-256color<span class="p">|</span>rxvt*<span class="p">|</span>screen-256color<span class="p">|</span>screen<span class="o">)</span>
<span class="w">			</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span>-n<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$PROMPT_COMMAND</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">				</span><span class="nb">export</span><span class="w"> </span><span class="nv">PROMPT_COMMAND</span><span class="o">=</span><span class="s2">&quot;__prompt_command;</span><span class="si">${</span><span class="nv">PROMPT_COMMAND</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="w">			</span><span class="k">else</span>
<span class="w">				</span><span class="nb">export</span><span class="w"> </span><span class="nv">PROMPT_COMMAND</span><span class="o">=</span><span class="s2">&quot;__prompt_command&quot;</span>
<span class="w">			</span><span class="k">fi</span>
<span class="w">		</span><span class="p">;;</span>
<span class="w">		</span>*<span class="o">)</span>
<span class="w">			</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span>-n<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$PROMPT_COMMAND</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">				</span><span class="nb">export</span><span class="w"> </span><span class="nv">PROMPT_COMMAND</span><span class="o">=</span><span class="s2">&quot;__prompt_command;</span><span class="si">${</span><span class="nv">PROMPT_COMMAND</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="w">			</span><span class="k">else</span>
<span class="w">				</span><span class="nb">export</span><span class="w"> </span><span class="nv">PROMPT_COMMAND</span><span class="o">=</span><span class="s2">&quot;__prompt_command&quot;</span>
<span class="w">			</span><span class="k">fi</span>
<span class="w">		</span><span class="p">;;</span>
<span class="w">	</span><span class="k">esac</span>
<span class="k">fi</span>
<span class="c1"># ----- HISTORY SUBMISSION IN $PROMPT_COMMAND ----- #</span>
<span class="k">if</span><span class="w"> </span>!<span class="w"> </span><span class="nb">printf</span><span class="w"> </span><span class="s2">&quot;%b&quot;</span><span class="w"> </span><span class="s2">&quot;</span><span class="nv">$PROMPT_COMMAND</span><span class="s2">&quot;</span><span class="p">|</span>grep<span class="w"> </span><span class="s1">&#39;history -a&#39;</span><span class="w"> </span>&gt;/dev/null<span class="p">;</span><span class="k">then</span>
<span class="w">	</span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span>-n<span class="w"> </span><span class="s2">&quot;</span><span class="nv">$PROMPT_COMMAND</span><span class="s2">&quot;</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span>
<span class="w">		</span><span class="nb">export</span><span class="w"> </span><span class="nv">PROMPT_COMMAND</span><span class="o">=</span><span class="s2">&quot;</span><span class="nv">$PROMPT_COMMAND</span><span class="s2">;history -a;history -c;history -r&quot;</span>
<span class="w">	</span><span class="k">else</span>
<span class="w">		</span><span class="nb">export</span><span class="w"> </span><span class="nv">PROMPT_COMMAND</span><span class="o">=</span><span class="s2">&quot;history -a;history -c;history -r&quot;</span>
<span class="w">	</span><span class="k">fi</span>
<span class="k">fi</span>
</pre></div>
</code></pre></td></tr></table>
</div> <!-- class=content -->
<!--/div>
<footer class="footer">
	<p-->
	<div class="footer">
		&copy; 2014-2019 lirion.de &ndash; served by <a href="https://git.zx2c4.com/cgit/about/">cgit</a> &ndash; All Rights Reverse Engineered
	</div>
	<!--/p>
</footer>
<div-->
</div> <!-- id=cgit -->
</body>
</html>
