<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.webos-internals.org/index.php?action=history&amp;feed=atom&amp;title=Colorful_Bash_Prompt</id>
	<title>Colorful Bash Prompt - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.webos-internals.org/index.php?action=history&amp;feed=atom&amp;title=Colorful_Bash_Prompt"/>
	<link rel="alternate" type="text/html" href="http://wiki.webos-internals.org/index.php?title=Colorful_Bash_Prompt&amp;action=history"/>
	<updated>2026-04-24T22:40:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>http://wiki.webos-internals.org/index.php?title=Colorful_Bash_Prompt&amp;diff=3528&amp;oldid=prev</id>
		<title>Raeb: adding link to ls --color</title>
		<link rel="alternate" type="text/html" href="http://wiki.webos-internals.org/index.php?title=Colorful_Bash_Prompt&amp;diff=3528&amp;oldid=prev"/>
		<updated>2009-08-03T02:01:28Z</updated>

		<summary type="html">&lt;p&gt;adding link to ls --color&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:01, 3 August 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l84&quot; &gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;unset use_color safe_term match_lhs&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;unset use_color safe_term match_lhs&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt; &lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Please note that when running as root, ls --color will segfault. See [[How To Use &amp;quot;ls&amp;quot; In Color]] for more information.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Raeb</name></author>
	</entry>
	<entry>
		<id>http://wiki.webos-internals.org/index.php?title=Colorful_Bash_Prompt&amp;diff=1286&amp;oldid=prev</id>
		<title>PuffTheMagic: Bashrc moved to Colorful Bash Prompt</title>
		<link rel="alternate" type="text/html" href="http://wiki.webos-internals.org/index.php?title=Colorful_Bash_Prompt&amp;diff=1286&amp;oldid=prev"/>
		<updated>2009-07-21T04:32:39Z</updated>

		<summary type="html">&lt;p&gt;&lt;a href=&quot;/wiki/Bashrc&quot; class=&quot;mw-redirect&quot; title=&quot;Bashrc&quot;&gt;Bashrc&lt;/a&gt; moved to &lt;a href=&quot;/wiki/Colorful_Bash_Prompt&quot; title=&quot;Colorful Bash Prompt&quot;&gt;Colorful Bash Prompt&lt;/a&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left diff-editfont-monospace&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:32, 21 July 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>PuffTheMagic</name></author>
	</entry>
	<entry>
		<id>http://wiki.webos-internals.org/index.php?title=Colorful_Bash_Prompt&amp;diff=1285&amp;oldid=prev</id>
		<title>PuffTheMagic: New page: __NOTOC__ Edit /etc/profile and change: &lt;source lang=&quot;bash&quot;&gt; if [ &quot;$PS1&quot; ]; then # works for bash and ash (no other shells known to be in use here)    PS1='\u@\h:\w\$ ' fi &lt;/source&gt; to thi...</title>
		<link rel="alternate" type="text/html" href="http://wiki.webos-internals.org/index.php?title=Colorful_Bash_Prompt&amp;diff=1285&amp;oldid=prev"/>
		<updated>2009-07-21T04:32:10Z</updated>

		<summary type="html">&lt;p&gt;New page: __NOTOC__ Edit /etc/profile and change: &amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt; if [ &amp;quot;$PS1&amp;quot; ]; then # works for bash and ash (no other shells known to be in use here)    PS1=&amp;#039;\u@\h:\w\$ &amp;#039; fi &amp;lt;/source&amp;gt; to thi...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
Edit /etc/profile and change:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ &amp;quot;$PS1&amp;quot; ]; then&lt;br /&gt;
# works for bash and ash (no other shells known to be in use here)&lt;br /&gt;
   PS1='\u@\h:\w\$ '&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
to this:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
if [ -n &amp;quot;${BASH_VERSION}&amp;quot; ] ; then&lt;br /&gt;
        if [ -f /etc/bash/bashrc ] ; then&lt;br /&gt;
                . /etc/bash/bashrc&lt;br /&gt;
        else&lt;br /&gt;
                PS1='\u@\h \w \$ '&lt;br /&gt;
        fi&lt;br /&gt;
else&lt;br /&gt;
        PS1=&amp;quot;${USER:-$(type whoami &amp;gt;/dev/null &amp;amp;&amp;amp; whoami)}@$(type uname &amp;gt;/dev/null &amp;amp;&amp;amp; uname -n) \$ &amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create this directory:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
mkdir /etc/bash&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Save the file below in /etc/bash/bashrc&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
# /etc/bash/bashrc                                                                                                        &lt;br /&gt;
if [[ $- != *i* ]] ; then                                            &lt;br /&gt;
        # Shell is non-interactive.  Be done now!                    &lt;br /&gt;
        return                                                       &lt;br /&gt;
fi                                                                   &lt;br /&gt;
&lt;br /&gt;
shopt -s checkwinsize                                               &lt;br /&gt;
&lt;br /&gt;
shopt -s histappend                                        &lt;br /&gt;
&lt;br /&gt;
case ${TERM} in                          &lt;br /&gt;
        xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)&lt;br /&gt;
                PROMPT_COMMAND='echo -ne &amp;quot;\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007&amp;quot;'&lt;br /&gt;
                ;;                                                                           &lt;br /&gt;
        screen)                                                                              &lt;br /&gt;
                PROMPT_COMMAND='echo -ne &amp;quot;\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\&amp;quot;'&lt;br /&gt;
                ;;                                                                           &lt;br /&gt;
esac                                                                                         &lt;br /&gt;
&lt;br /&gt;
use_color=true&lt;br /&gt;
&lt;br /&gt;
safe_term=${TERM//[^[:alnum:]]/?}   # sanitize TERM              &lt;br /&gt;
match_lhs=&amp;quot;&amp;quot;                                                     &lt;br /&gt;
[[ -f ~/.dir_colors   ]] &amp;amp;&amp;amp; match_lhs=&amp;quot;${match_lhs}$(&amp;lt;~/.dir_colors)&amp;quot;&lt;br /&gt;
[[ -f /etc/DIR_COLORS ]] &amp;amp;&amp;amp; match_lhs=&amp;quot;${match_lhs}$(&amp;lt;/etc/DIR_COLORS)&amp;quot;&lt;br /&gt;
[[ -z ${match_lhs}    ]] \&lt;br /&gt;
        &amp;amp;&amp;amp; type -P dircolors &amp;gt;/dev/null \&lt;br /&gt;
        &amp;amp;&amp;amp; match_lhs=$(dircolors --print-database)&lt;br /&gt;
[[ $'\n'${match_lhs} == *$'\n'&amp;quot;TERM &amp;quot;${safe_term}* ]] &amp;amp;&amp;amp; use_color=true&lt;br /&gt;
&lt;br /&gt;
if ${use_color} ; then&lt;br /&gt;
        # Enable colors for ls, etc.  Prefer ~/.dir_colors #64489&lt;br /&gt;
        if type -P dircolors &amp;gt;/dev/null ; then&lt;br /&gt;
                if [[ -f ~/.dir_colors ]] ; then&lt;br /&gt;
                        eval $(dircolors -b ~/.dir_colors)&lt;br /&gt;
                elif [[ -f /etc/DIR_COLORS ]] ; then&lt;br /&gt;
                        eval $(dircolors -b /etc/DIR_COLORS)&lt;br /&gt;
                fi&lt;br /&gt;
        fi&lt;br /&gt;
&lt;br /&gt;
        if [[ ${EUID} == 0 ]] ; then&lt;br /&gt;
                PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] '&lt;br /&gt;
        else&lt;br /&gt;
                PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '&lt;br /&gt;
        fi&lt;br /&gt;
&lt;br /&gt;
else&lt;br /&gt;
        if [[ ${EUID} == 0 ]] ; then&lt;br /&gt;
                # show root@ when we don't have colors&lt;br /&gt;
                PS1='\u@\h \W \$ '&lt;br /&gt;
        else&lt;br /&gt;
                PS1='\u@\h \w \$ '&lt;br /&gt;
        fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
unset use_color safe_term match_lhs&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>PuffTheMagic</name></author>
	</entry>
</feed>