<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog.ubrious &#187; linux</title>
	<atom:link href="http://blog.ubrio.us/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ubrio.us</link>
	<description>An Ordinary Web Developer's Blog</description>
	<lastBuildDate>Thu, 19 Jan 2012 00:44:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Best Bash Prompt</title>
		<link>http://blog.ubrio.us/nix/best-bash-prompt/</link>
		<comments>http://blog.ubrio.us/nix/best-bash-prompt/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 05:25:20 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[ps1]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/bash-prompt-madness/</guid>
		<description><![CDATA[Okay &#8212; so after that last post I decided it was time for a change. I&#8217;ve had the same bash prompt for years and was starting to get tired of it. Over the past 30 or so minutes I&#8217;ve been hating life learning way more than I wanted to about PS1, colors and embedded IF [...]]]></description>
			<content:encoded><![CDATA[<p>Okay &#8212; so after that last post I decided it was time for a change. I&#8217;ve had the same bash prompt for years and was starting to get tired of it. Over the past 30 or so minutes I&#8217;ve been <del>hating life</del> learning way more than I wanted to about PS1, colors and embedded IF statements.</p>
<p>And yes, this needs it own post simply for the fact that this is an insane prompt. Heres what it is/can do:</p>
<ol>
<li>Automatically shortens itself if the path is longer than 18 charachters<br/><small>This is what I&#8217;ve always wanted since I usually name my folders after the website URL &#8212; and I <em>HATE</em> 2 line prompts.</small></li>
<li>Changes to red if the last command didn&#8217;t have a return code of 0</li>
<li>Includes your bash history # for easy <a href="http://linux.deadgod.net/2007/01/01/Special_Bash_Variables_I" onclick="pageTracker._trackPageview('/outgoing/linux.deadgod.net/2007/01/01/Special_Bash_Variables_I?referer=');">history command repeating</a></li>
<li>Is pretty neat and trim</li>
</ol>
<h5>Why is this rad?</h5>
<div class='wp-caption alignleft'>
<img src="http://file.ubrio.us/misc/best_bash_prompt_ever.png" /></p>
<p class='wp-caption-text'>Prompt Madness!</p>
</div>
<p>I&#8217;ll let this image explain what it does and how it looks&#8230;</p>
<p><br clear='left' /></p>
<p>I&#8217;m tossing up a text file here -> <a href="http://file.ubrio.us/misc/best_bash_prompt_ever.txt" onclick="pageTracker._trackPageview('/outgoing/file.ubrio.us/misc/best_bash_prompt_ever.txt?referer=');">best_bash_prompt_ever.txt</a> &#8212; since the escaping will probably be messed up.</p>
<pre>
export PROMPT_COMMAND='PS1="\[\033[0;33m\][\!]\`if [[ \$? = "0" ]]; then echo "\\[\\033[32m\\]"; else echo "\\[\\033[31m\\]"; fi\`[\u.\h: \`if [[ `pwd|wc -c|tr -d " "` > 18 ]]; then echo "\\W"; else echo "\\w"; fi\`]\$\[\033[0m\] "; echo -ne "\033]0;`hostname -s`:`pwd`\007"'
</pre>
<div class='help'>The second half (from &#8220;echo -ne&#8230;&#8221; on) is for the Terminal&#8217;s title.</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/nix/best-bash-prompt/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

