User:Mattx86/Bash Profile: Difference between revisions

From Alpine Linux
m (Another update)
mNo edit summary
Line 2: Line 2:


<pre>alias apk='apk --progress'
<pre>alias apk='apk --progress'
alias nano='nano -c'


COL_YEL="\[\e[1;33m\]"
COL_YEL="\[\e[1;33m\]"
Line 10: Line 11:


if test "$UID" -eq 0 ; then
if test "$UID" -eq 0 ; then
_COL_USER=$COL_RED
        _COL_USER=$COL_RED
_p=" #"
        _p=" #"
else
else
_COL_USER=$COL_GRE
        _COL_USER=$COL_GRE
_p=">"
        _p=">"
fi
fi
COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]"
COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]"
case $TERM in
case $TERM in
*term | rxvt | screen )
        *term | rxvt | screen )
PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;;
                PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;;
linux )
        linux | vt100 )
PS1="${COLORIZED_PROMPT}" ;;
                PS1="${COLORIZED_PROMPT}" ;;
* )
        * )
PS1="\u@\h:\w${_p} " ;;
                PS1="\u@\h:\w${_p} " ;;
esac
esac
shopt -s checkwinsize</pre>
shopt -s checkwinsize</pre>
Be sure to symlink <code>.bashrc</code> to <code>.bash_profile</code>.

Revision as of 00:52, 13 December 2010

Here's the ~/.bash_profile that I use:

alias apk='apk --progress'
alias nano='nano -c'

COL_YEL="\[\e[1;33m\]"
COL_GRA="\[\e[0;37m\]"
COL_WHI="\[\e[1;37m\]"
COL_GRE="\[\e[1;32m\]"
COL_RED="\[\e[1;31m\]"

if test "$UID" -eq 0 ; then
        _COL_USER=$COL_RED
        _p=" #"
else
        _COL_USER=$COL_GRE
        _p=">"
fi
COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]"
case $TERM in
        *term | rxvt | screen )
                PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;;
        linux | vt100 )
                PS1="${COLORIZED_PROMPT}" ;;
        * )
                PS1="\u@\h:\w${_p} " ;;
esac
shopt -s checkwinsize

Be sure to symlink .bashrc to .bash_profile.