<?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: Bash Shell PS1: 10 Examples to Make Your Linux Prompt like Angelina Jolie</title>
	<atom:link href="http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/</link>
	<description>Guides, HowTos and Tips for Technology Geeks</description>
	<lastBuildDate>Thu, 09 Feb 2012 13:04:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-162437</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Mon, 26 Dec 2011 20:28:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-162437</guid>
		<description>@ liming xing
Read &#039;man bash&#039;. It is explained into the FILES section, at the end.
It is ~/.bash_profile or ~/.bashrc.</description>
		<content:encoded><![CDATA[<p>@ liming xing<br />
Read &#8216;man bash&#8217;. It is explained into the FILES section, at the end.<br />
It is ~/.bash_profile or ~/.bashrc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: liming xing</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-162124</link>
		<dc:creator>liming xing</dc:creator>
		<pubDate>Mon, 26 Dec 2011 06:06:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-162124</guid>
		<description>Hello:
Excuse me, how do I get in shell file PS1 variables</description>
		<content:encoded><![CDATA[<p>Hello:<br />
Excuse me, how do I get in shell file PS1 variables</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-148576</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Thu, 01 Dec 2011 15:48:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-148576</guid>
		<description>It&#039;d be nice to note in (9) that export PS1=&quot;\u@\h [`httpdcount`]&gt; &quot; would render the httpdcount *when the window is opened* while export PS1=&quot;\u@\h [\`httpdcount\`]&gt; &quot; would render an updated httpdcount each time a prompt is rendered.

I&#039;m using 
export PS1=&quot;\h:\`pwd &#124; sed &#039;s/^.*\(\/.*\/.*\)$/\1/&#039;\`$  &quot; to display the most recent 2 directories.</description>
		<content:encoded><![CDATA[<p>It&#8217;d be nice to note in (9) that export PS1=&#8221;\u@\h [`httpdcount`]&gt; &#8221; would render the httpdcount *when the window is opened* while export PS1=&#8221;\u@\h [\`httpdcount\`]&gt; &#8221; would render an updated httpdcount each time a prompt is rendered.</p>
<p>I&#8217;m using<br />
export PS1=&#8221;\h:\`pwd | sed &#8216;s/^.*\(\/.*\/.*\)$/\1/&#8217;\`$  &#8221; to display the most recent 2 directories.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shane</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-127494</link>
		<dc:creator>Shane</dc:creator>
		<pubDate>Thu, 15 Sep 2011 04:10:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-127494</guid>
		<description>For years now I&#039;ve been using something like
PS1=&quot;\`if [ \$? != 0 ]; then echo \[\e[33m\]---=== \[\e[31m\]Oh noes, bad command \[\e[33m\]===---; else echo \e[33m\]#Yay, comamnd succeeded\[\e[0m\]; fi\`\n\n\[\e[0;37m\]#\[\e[1;34m\]xX \[\e[1;32m\]Company Inc. \[\e[1;34m\]Xx\n\[\e[0;37m\]#[\[\e[1;34m\]\w\[\e[0;37m\]]\[\e[0;37m\][\[\e[1;31m\]\j\[\e[0;37m\]][\[\e[1;35m\]\A\[\e[0;37m\]]\[\e[0;37m\][\[\e[0;32m\]\!\[\e[0;37m\]]\[\e[0;37m\][\[\e[1;32m\]\#\[\e[0;37m\]]\n\[\e[0;37m\]#\[\e[0;32m\]\u@\H \[\e[1;31m\]\$ \n &quot;

Which gives me something like:

#xX Company Inc. Xx
#[~][0][23:58][507][6]
#User@Host $

The top is a vanity header, the bottom is pretty much your standard User@Host.All commands start at the next line, which when paired with the leading hashes, helps make for easy script copying, as mentioned before. The second line is really where I get all the info I need. It breaks down as: 

#[Working directly][Number of jobs in background][Time in 24H format][History of command][History of command for this session]

Also, if the command succeeds, I get a &quot;#Yay, comamnd succeeded&quot; - if it fails, I get the &quot;---=== Oh noes, bad command ===---&quot; message.</description>
		<content:encoded><![CDATA[<p>For years now I&#8217;ve been using something like<br />
PS1=&#8221;\`if [ \$? != 0 ]; then echo \[\e[33m\]&#8212;=== \[\e[31m\]Oh noes, bad command \[\e[33m\]===&#8212;; else echo \e[33m\]#Yay, comamnd succeeded\[\e[0m\]; fi\`\n\n\[\e[0;37m\]#\[\e[1;34m\]xX \[\e[1;32m\]Company Inc. \[\e[1;34m\]Xx\n\[\e[0;37m\]#[\[\e[1;34m\]\w\[\e[0;37m\]]\[\e[0;37m\][\[\e[1;31m\]\j\[\e[0;37m\]][\[\e[1;35m\]\A\[\e[0;37m\]]\[\e[0;37m\][\[\e[0;32m\]\!\[\e[0;37m\]]\[\e[0;37m\][\[\e[1;32m\]\#\[\e[0;37m\]]\n\[\e[0;37m\]#\[\e[0;32m\]\u@\H \[\e[1;31m\]\$ \n &#8221;</p>
<p>Which gives me something like:</p>
<p>#xX Company Inc. Xx<br />
#[~][0][23:58][507][6]<br />
#User@Host $</p>
<p>The top is a vanity header, the bottom is pretty much your standard <a href="mailto:User@Host.All">User@Host.All</a> commands start at the next line, which when paired with the leading hashes, helps make for easy script copying, as mentioned before. The second line is really where I get all the info I need. It breaks down as: </p>
<p>#[Working directly][Number of jobs in background][Time in 24H format][History of command][History of command for this session]</p>
<p>Also, if the command succeeds, I get a &#8220;#Yay, comamnd succeeded&#8221; &#8211; if it fails, I get the &#8220;&#8212;=== Oh noes, bad command ===&#8212;&#8221; message.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-104201</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Fri, 20 May 2011 15:45:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-104201</guid>
		<description>Sorry for the multiple posts, but I now realize that the only thing needed to accomplish this is to include a backslash before the $PWD. This ensures that the current working directory is determined each time the prompt is created; without the backslash it would be determined just once and would never change.

PS1=”\u@\h \$PWD&gt;”</description>
		<content:encoded><![CDATA[<p>Sorry for the multiple posts, but I now realize that the only thing needed to accomplish this is to include a backslash before the $PWD. This ensures that the current working directory is determined each time the prompt is created; without the backslash it would be determined just once and would never change.</p>
<p>PS1=”\u@\h \$PWD&gt;”</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-104066</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Thu, 19 May 2011 19:26:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-104066</guid>
		<description>On reflection, it looks as though something as simple as this works:

PS1=”\u@\h \$(echo -n \$PWD)&gt;”</description>
		<content:encoded><![CDATA[<p>On reflection, it looks as though something as simple as this works:</p>
<p>PS1=”\u@\h \$(echo -n \$PWD)&gt;”</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jim</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-104059</link>
		<dc:creator>Jim</dc:creator>
		<pubDate>Thu, 19 May 2011 18:39:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-104059</guid>
		<description>I&#039;m liking the examples! Here&#039;s a possible way to get the prompt to list the home directory in the &quot;/home/username&quot; format instead of a tilde (~):

curdir(){
if [ $PWD == /home/$USER ]
then
echo -n /home/$USER
else
echo -n $PWD
fi
}

PS1=&quot;\u@\h \$(curdir)&gt;&quot;</description>
		<content:encoded><![CDATA[<p>I&#8217;m liking the examples! Here&#8217;s a possible way to get the prompt to list the home directory in the &#8220;/home/username&#8221; format instead of a tilde (~):</p>
<p>curdir(){<br />
if [ $PWD == /home/$USER ]<br />
then<br />
echo -n /home/$USER<br />
else<br />
echo -n $PWD<br />
fi<br />
}</p>
<p>PS1=&#8221;\u@\h \$(curdir)&gt;&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-91302</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 09 Mar 2011 14:49:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-91302</guid>
		<description>#-------------------------------------------------------------
# GIT on Prompt
#-------------------------------------------------------------
function _git_color_status()
{
	status=&quot;`git status --porcelain 2&gt;/dev/null`&quot;

	#not a git repository
	if [ $? -ne 0 ]; then
		echo -ne $darkgray
	elif [ `echo &quot;$status&quot; &#124; grep &quot;M&quot; &#124; wc -l` != &quot;0&quot; ]; then
		echo -ne $red
	elif [ `echo &quot;$status&quot; &#124; grep &quot;A&quot; &#124; wc -l` != &quot;0&quot; ]; then
		echo -ne $yellow
	elif [ `echo &quot;$status&quot; &#124; grep &quot;??&quot; &#124; wc -l` != &quot;0&quot; ]; then
		echo -ne $cyan
	else
		echo -ne $HILIT2
	fi
}

function gitmode()
{
    if [ -z $1 ] ; then
		return
	fi
    if [ $1 = &#039;on&#039; -a -z &quot;$OLD_PS1&quot; ]; then
        alias pull=&#039;git pull&#039;
        alias push=&#039;git push&#039;
        alias commit=&#039;git commit -a&#039;
        alias add=&#039;git add&#039;
		#git aliased to git-publish -&gt; push current branch` to origin and then track
        alias publish=&#039;git publish&#039;
        alias status=&#039;git status&#039;
        OLD_PS1=&quot;$PS1&quot;
        PS1=&quot;\[\$(_git_color_status)\][GIT] $PS1&quot;
		unset PREFIX
    elif [ $1 = &#039;off&#039; -a -n &quot;$OLD_PS1&quot; ]; then
        unalias pull 2&gt; /dev/null
        unalias push 2&gt; /dev/null
        unalias commit 2&gt; /dev/null
        unalias add 2&gt; /dev/null
        unalias publish 2&gt; /dev/null
        unalias status 2&gt; /dev/null
        PS1=&quot;$OLD_PS1&quot;
		unset OLD_PS1
    fi
}</description>
		<content:encoded><![CDATA[<p>#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
# GIT on Prompt<br />
#&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
function _git_color_status()<br />
{<br />
	status=&#8221;`git status &#8211;porcelain 2&gt;/dev/null`&#8221;</p>
<p>	#not a git repository<br />
	if [ $? -ne 0 ]; then<br />
		echo -ne $darkgray<br />
	elif [ `echo "$status" | grep "M" | wc -l` != "0" ]; then<br />
		echo -ne $red<br />
	elif [ `echo "$status" | grep "A" | wc -l` != "0" ]; then<br />
		echo -ne $yellow<br />
	elif [ `echo "$status" | grep "??" | wc -l` != "0" ]; then<br />
		echo -ne $cyan<br />
	else<br />
		echo -ne $HILIT2<br />
	fi<br />
}</p>
<p>function gitmode()<br />
{<br />
    if [ -z $1 ] ; then<br />
		return<br />
	fi<br />
    if [ $1 = 'on' -a -z "$OLD_PS1" ]; then<br />
        alias pull=&#8217;git pull&#8217;<br />
        alias push=&#8217;git push&#8217;<br />
        alias commit=&#8217;git commit -a&#8217;<br />
        alias add=&#8217;git add&#8217;<br />
		#git aliased to git-publish -&gt; push current branch` to origin and then track<br />
        alias publish=&#8217;git publish&#8217;<br />
        alias status=&#8217;git status&#8217;<br />
        OLD_PS1=&#8221;$PS1&#8243;<br />
        PS1=&#8221;\[\$(_git_color_status)\][GIT] $PS1&#8243;<br />
		unset PREFIX<br />
    elif [ $1 = 'off' -a -n "$OLD_PS1" ]; then<br />
        unalias pull 2&gt; /dev/null<br />
        unalias push 2&gt; /dev/null<br />
        unalias commit 2&gt; /dev/null<br />
        unalias add 2&gt; /dev/null<br />
        unalias publish 2&gt; /dev/null<br />
        unalias status 2&gt; /dev/null<br />
        PS1=&#8221;$OLD_PS1&#8243;<br />
		unset OLD_PS1<br />
    fi<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Atul</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-90287</link>
		<dc:creator>Atul</dc:creator>
		<pubDate>Wed, 02 Mar 2011 21:01:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-90287</guid>
		<description>Hello,
I have a strange error when I try to set PS1. I use
PS1=&quot;\h:\w $ &quot; 
because I want the host followed by the current working directory. But the prompt I get is:
h:w$

How do  I correct this?</description>
		<content:encoded><![CDATA[<p>Hello,<br />
I have a strange error when I try to set PS1. I use<br />
PS1=&#8221;\h:\w $ &#8221;<br />
because I want the host followed by the current working directory. But the prompt I get is:<br />
h:w$</p>
<p>How do  I correct this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jabba Laci</title>
		<link>http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/comment-page-1/#comment-84892</link>
		<dc:creator>Jabba Laci</dc:creator>
		<pubDate>Wed, 09 Feb 2011 00:59:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.thegeekstuff.com/?p=167#comment-84892</guid>
		<description>Just for fun, I wanted to emulate the MS-DOS prompt:

function msdos_pwd {
   echo `pwd` &#124; tr &#039;/&#039; &#039;\\&#039;
}

export PS1=&#039;C:`msdos_pwd`&gt; &#039;</description>
		<content:encoded><![CDATA[<p>Just for fun, I wanted to emulate the MS-DOS prompt:</p>
<p>function msdos_pwd {<br />
   echo `pwd` | tr &#8216;/&#8217; &#8216;\\&#8217;<br />
}</p>
<p>export PS1=&#8217;C:`msdos_pwd`&gt; &#8216;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Content Delivery Network via Amazon Web Services: CloudFront: static.thegeekstuff.com

Served from: www.thegeekstuff.com @ 2012-02-09 16:03:28 -->
