<?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>adamblog &#187; ENV</title>
	<atom:link href="http://blog.amyl.org.uk/category/env/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.amyl.org.uk</link>
	<description>software frustrations, political ranting, general whinging, course language, half-arsed attempt at blogging</description>
	<lastBuildDate>Thu, 03 Jun 2010 19:02:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Conditional Prompt colo(u)rs</title>
		<link>http://blog.amyl.org.uk/2009/12/conditional-prompt-colors/</link>
		<comments>http://blog.amyl.org.uk/2009/12/conditional-prompt-colors/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 16:45:04 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[ENV]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[machine set-up]]></category>
		<category><![CDATA[misc]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[colour]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[dotfiles]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[PS1]]></category>

		<guid isPermaLink="false">http://tanqueray.amyl.org.uk/~adam/blog/?p=61</guid>
		<description><![CDATA[setting a colored prompt; different color for different machines based on hostname, oh yes.]]></description>
			<content:encoded><![CDATA[<p>I often work on several different machines, for different projects and things. It&#8217;s bloody annoying when I get the wrong machine!</p>
<p>I thought. I know what, I&#8217;ll make all of these machines use a colored prompt, and make that lot of machines use a different one.</p>
<p>(At this point, I should say that my dotfiles, and a variety of other things are kept in a subversion repo. Most of those bits are my-eyes-only (particularly a lot of the very badly/hastily thrown together scripts), but a few bits I&#8217;m gradually releasing.)</p>
<p>After mentioning this on <a href="http://twitter.com/adamamyl/status/6945837040">twitter</a>, a couple of people have been interested in how I did it.</p>
<p>The solution is quite easy, work out the hostname, and from that determine the &#8216;class&#8217; of machine, and then apply some colors. The <a href="http://wiki.archlinux.org/index.php/Color_Bash_Prompt#Wolfman.27s">archwiki</a> was useful in getting out the colors to use; along with underlining, and emboldening (I <strong>never</strong> use underlining, except in manuscript: ghastly thing that obscures text).</p>
<p>Whilst not perfect (the color parts could be set as a variable, and then passed to the PS1 line; I could have used &#8220;else&#8221; clauses&#8230;), it works. For me, so, erm, here&#8217;s <a href="http://code.amyl.org.uk/adam/dotfiles/bashrc">my .bashrc</a> &#8212; you want from the <code># work out machine name/domain:</code> line.</p>
<p>A simple switch wotsits in <code>screen(1)</code>, and</p>
<p><code>$ cd ~/pseudohome &#038;&#038; svn up</code></p>
<p>followed with a </p>
<p><code> $ . .bashrc</code></p>
<p>is how I deploy (some people have an &#8217;svn up&#8217; in their start-up scripts, I don&#8217;t).</p>
<p>Comments here, if you want to.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.amyl.org.uk/2009/12/conditional-prompt-colors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
