<?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: Customizing the Terminal: The Prompt</title>
	<atom:link href="http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/feed/" rel="self" type="application/rss+xml" />
	<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/</link>
	<description>Linux - on the Desktop</description>
	<lastBuildDate>Fri, 23 Jul 2010 14:38:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Darren Embry</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4628</link>
		<dc:creator>Darren Embry</dc:creator>
		<pubDate>Tue, 18 May 2010 17:54:17 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4628</guid>
		<description>@newbie, You need to surround any terminal escape sequences with \[ and \], i.e., do this:

export PS1=&quot;\[\e[0;31m\][\u@\h \W]\$ \[\e[m\] &quot;

The PROMPTING section of bash(1) documents this.

You may also wish to read tput(1) and terminfo(5) if you want to be terminal-agnostic.</description>
		<content:encoded><![CDATA[<p>@newbie, You need to surround any terminal escape sequences with \[ and \], i.e., do this:</p>
<p>export PS1=&#8221;\[\e[0;31m\][\u@\h \W]\$ \[\e[m\] &#8221;</p>
<p>The PROMPTING section of bash(1) documents this.</p>
<p>You may also wish to read tput(1) and terminfo(5) if you want to be terminal-agnostic.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: newbie</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4627</link>
		<dc:creator>newbie</dc:creator>
		<pubDate>Tue, 18 May 2010 17:10:02 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4627</guid>
		<description>hi, when I use the command:

export PS1=&quot;\e[0;31m[\u@\h \W]\$ \e[m &quot;

I am unable to add lines while I am writing code. for example

when I am writing a script on command line, it does not add a new line, it simply overrides the prompt line.
ex:
PROMPT $

&#124; grep &quot;&gt;&quot; &#124;  PROMPT$  cat namefile.txt &#124;

is there a way around it?</description>
		<content:encoded><![CDATA[<p>hi, when I use the command:</p>
<p>export PS1=&#8221;\e[0;31m[\u@\h \W]\$ \e[m &#8221;</p>
<p>I am unable to add lines while I am writing code. for example</p>
<p>when I am writing a script on command line, it does not add a new line, it simply overrides the prompt line.<br />
ex:<br />
PROMPT $</p>
<p>| grep &#8220;&gt;&#8221; |  PROMPT$  cat namefile.txt |</p>
<p>is there a way around it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Di Pasquale</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4489</link>
		<dc:creator>Matt Di Pasquale</dc:creator>
		<pubDate>Sat, 18 Jul 2009 16:30:53 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4489</guid>
		<description>Hmmm... a quick man sed and a guess...
changed -re to -E and seems to work now...

PROMPT_COMMAND=&#039;CurDir=`pwd&#124;sed -e &quot;s!$HOME!~!&quot;&#124;sed -E &quot;s!([^/])[^/]+/!\1/!g&quot;`&#039;
PS1=&quot;[\$CurDir] \$ &quot;

nice.</description>
		<content:encoded><![CDATA[<p>Hmmm&#8230; a quick man sed and a guess&#8230;<br />
changed -re to -E and seems to work now&#8230;</p>
<p>PROMPT_COMMAND=&#8217;CurDir=`pwd|sed -e &#8220;s!$HOME!~!&#8221;|sed -E &#8220;s!([^/])[^/]+/!\1/!g&#8221;`&#8217;<br />
PS1=&#8221;[\$CurDir] \$ &#8221;</p>
<p>nice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Di Pasquale</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4488</link>
		<dc:creator>Matt Di Pasquale</dc:creator>
		<pubDate>Sat, 18 Jul 2009 16:26:39 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4488</guid>
		<description>Oops. I tried the last approach (which you use) and got this error on my Mac, running OS X 10.5.7

sed: illegal option -- r
usage: sed script [-Ealn] [-i extension] [file ...]
       sed [-Ealn] [-i extension] [-e script] ... [-f script_file] ... [file ...]</description>
		<content:encoded><![CDATA[<p>Oops. I tried the last approach (which you use) and got this error on my Mac, running OS X 10.5.7</p>
<p>sed: illegal option &#8212; r<br />
usage: sed script [-Ealn] [-i extension] [file ...]<br />
       sed [-Ealn] [-i extension] [-e script] &#8230; [-f script_file] &#8230; [file ...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Di Pasquale</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4486</link>
		<dc:creator>Matt Di Pasquale</dc:creator>
		<pubDate>Sat, 18 Jul 2009 07:31:26 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4486</guid>
		<description>Thanks!
This is awesome! :)
-Matt</description>
		<content:encoded><![CDATA[<p>Thanks!<br />
This is awesome! <img src='http://lindesk.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
-Matt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Customizing the Terminal: 5 Configuration Settings in Bash that makes you a CLI Power User &#124; LinDesk</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4253</link>
		<dc:creator>Customizing the Terminal: 5 Configuration Settings in Bash that makes you a CLI Power User &#124; LinDesk</dc:creator>
		<pubDate>Sun, 12 Apr 2009 19:40:14 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4253</guid>
		<description>[...] Customizing the Terminal: The Prompt [...]</description>
		<content:encoded><![CDATA[<p>[...] Customizing the Terminal: The Prompt [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Links of the Week</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4228</link>
		<dc:creator>Links of the Week</dc:creator>
		<pubDate>Sun, 29 Mar 2009 04:37:44 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4228</guid>
		<description>[...] the terminal -Â Parts IÂ andÂ IIÂ - Binny writes on how you can customize the terminal prompt and add [...]</description>
		<content:encoded><![CDATA[<p>[...] the terminal -Â Parts IÂ andÂ IIÂ - Binny writes on how you can customize the terminal prompt and add [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adding Social Bookmarking Button in WordPress - Without Plugins &#124; Bin-Blog</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4226</link>
		<dc:creator>Adding Social Bookmarking Button in WordPress - Without Plugins &#124; Bin-Blog</dc:creator>
		<pubDate>Sat, 28 Mar 2009 17:49:02 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4226</guid>
		<description>[...] text links. If you get the favicons of the sites you&#8217;re linking to, it will look a lot nicer. Example (go to the end of the post). You can use bigger images as well - example. Or use some kind of [...]</description>
		<content:encoded><![CDATA[<p>[...] text links. If you get the favicons of the sites you&#8217;re linking to, it will look a lot nicer. Example (go to the end of the post). You can use bigger images as well &#8211; example. Or use some kind of [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Customizing the Terminal: Create Useful Aliases &#124; LinDesk</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4222</link>
		<dc:creator>Customizing the Terminal: Create Useful Aliases &#124; LinDesk</dc:creator>
		<pubDate>Fri, 27 Mar 2009 19:06:00 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4222</guid>
		<description>[...] is part two of the &#8216;Customizing the Terminal&#8217; series. Part one is &#8216;Customizing the Terminal: The Prompt&#8216;. In this part, we&#8217;ll see how to create aliases to make working in the console [...]</description>
		<content:encoded><![CDATA[<p>[...] is part two of the &#8216;Customizing the Terminal&#8217; series. Part one is &#8216;Customizing the Terminal: The Prompt&#8216;. In this part, we&#8217;ll see how to create aliases to make working in the console [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darren Embry</title>
		<link>http://lindesk.com/2009/03/customizing-the-terminal-the-prompt/comment-page-1/#comment-4191</link>
		<dc:creator>Darren Embry</dc:creator>
		<pubDate>Sun, 15 Mar 2009 01:03:09 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=181#comment-4191</guid>
		<description>Nice article.
I hate one-line hacks.
Here&#039;s an improvement:

_update_prompt () {
        DIR=`pwd&#124;sed -e &quot;s!$HOME!~!&quot;`
        if [ ${#DIR} -gt 30 ]; then
                CurDir=${DIR:0:12}...${DIR:${#DIR}-15}
        else
                CurDir=$DIR
        fi
}
PROMPT_COMMAND=_update_prompt
PS1=&quot;[\$CurDir] \$ &quot;

Also...

@ejes PROMPT_COMMAND does not need to be exported.

@wyn Make sure your ~/.profile or ~/.bash_profile sources ~/.bashrc.  From Debian&#039;s default .profile:

# if running bash
if [ -n &quot;$BASH_VERSION&quot; ]; then
    # include .bashrc if it exists
    if [ -f &quot;$HOME/.bashrc&quot; ]; then
        . &quot;$HOME/.bashrc&quot;
    fi
fi</description>
		<content:encoded><![CDATA[<p>Nice article.<br />
I hate one-line hacks.<br />
Here&#8217;s an improvement:</p>
<p>_update_prompt () {<br />
        DIR=`pwd|sed -e &#8220;s!$HOME!~!&#8221;`<br />
        if [ ${#DIR} -gt 30 ]; then<br />
                CurDir=${DIR:0:12}&#8230;${DIR:${#DIR}-15}<br />
        else<br />
                CurDir=$DIR<br />
        fi<br />
}<br />
PROMPT_COMMAND=_update_prompt<br />
PS1=&#8221;[\$CurDir] \$ &#8221;</p>
<p>Also&#8230;</p>
<p>@ejes PROMPT_COMMAND does not need to be exported.</p>
<p>@wyn Make sure your ~/.profile or ~/.bash_profile sources ~/.bashrc.  From Debian&#8217;s default .profile:</p>
<p># if running bash<br />
if [ -n "$BASH_VERSION" ]; then<br />
    # include .bashrc if it exists<br />
    if [ -f "$HOME/.bashrc" ]; then<br />
        . &#8220;$HOME/.bashrc&#8221;<br />
    fi<br />
fi</p>
]]></content:encoded>
	</item>
</channel>
</rss>
