<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Adding some VCS information in bash prompt</title>
	<atom:link href="http://glandium.org/blog/?feed=rss2&#038;p=170" rel="self" type="application/rss+xml" />
	<link>http://glandium.org/blog/?p=170</link>
	<description>glandium.org</description>
	<lastBuildDate>Sun, 05 Sep 2010 12:27:46 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Yaroslav Halchenko</title>
		<link>http://glandium.org/blog/?p=170&#038;cpage=1#comment-9280</link>
		<dc:creator>Yaroslav Halchenko</dc:creator>
		<pubDate>Wed, 24 Oct 2007 16:08:04 +0000</pubDate>
		<guid isPermaLink="false">http://web.glandium.org/blog/?p=170#comment-9280</guid>
		<description>Is your .bashrc_vcs (how I would name it before sourcing from .bash_profile) available entirely in 1 file somewhere on the web? or may be even better -- from some vcs?</description>
		<content:encoded><![CDATA[<p>Is your .bashrc_vcs (how I would name it before sourcing from .bash_profile) available entirely in 1 file somewhere on the web? or may be even better &#8212; from some vcs?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Hutchings</title>
		<link>http://glandium.org/blog/?p=170&#038;cpage=1#comment-9267</link>
		<dc:creator>Ben Hutchings</dc:creator>
		<pubDate>Sun, 14 Oct 2007 13:39:27 +0000</pubDate>
		<guid isPermaLink="false">http://web.glandium.org/blog/?p=170#comment-9267</guid>
		<description>bash miscalculates the length of a prompt if it includes non-printing escape sequences, and then makes a mess of wrapping input lines.  You have to put \[ and \] around those sequences.  I ended up with:

__vcs_dir() {
    ...
    if [ -n &quot;$vcs&quot; ]; then
	__vcs_prefix=&quot;($vcs)&quot;
	__vcs_base_dir=&quot;${base_dir/$HOME/~}&quot;
	__vcs_ref=&quot;[$ref]&quot;
	__vcs_sub_dir=&quot;${sub_dir}&quot;
    else
	__vcs_prefix=&#039;&#039;
	__vcs_base_dir=&quot;${PWD/$HOME/~}&quot;
	__vcs_ref=&#039;&#039;
	__vcs_sub_dir=&#039;&#039;
    fi
}

PROMPT_COMMAND=__vcs_dir
PS1=&#039;${debian_chroot:+($debian_chroot)}\u@\h:$__vcs_prefix\[${_bold}\]${__vcs_base_dir}\[${_normal}\]${__vcs_ref}\[${_bold}\]${__vcs_sub_dir}\[${_normal}\]\$</description>
		<content:encoded><![CDATA[<p>bash miscalculates the length of a prompt if it includes non-printing escape sequences, and then makes a mess of wrapping input lines.  You have to put \[ and \] around those sequences.  I ended up with:</p>
<p>__vcs_dir() {<br />
    &#8230;<br />
    if [ -n "$vcs" ]; then<br />
	__vcs_prefix=&#8221;($vcs)&#8221;<br />
	__vcs_base_dir=&#8221;${base_dir/$HOME/~}&#8221;<br />
	__vcs_ref=&#8221;[$ref]&#8221;<br />
	__vcs_sub_dir=&#8221;${sub_dir}&#8221;<br />
    else<br />
	__vcs_prefix=&#8221;<br />
	__vcs_base_dir=&#8221;${PWD/$HOME/~}&#8221;<br />
	__vcs_ref=&#8221;<br />
	__vcs_sub_dir=&#8221;<br />
    fi<br />
}</p>
<p>PROMPT_COMMAND=__vcs_dir<br />
PS1=&#8217;${debian_chroot:+($debian_chroot)}\u@\h:$__vcs_prefix\[${_bold}\]${__vcs_base_dir}\[${_normal}\]${__vcs_ref}\[${_bold}\]${__vcs_sub_dir}\[${_normal}\]\$</p>
]]></content:encoded>
	</item>
</channel>
</rss>
