Kudos to whomever suggested the PS1 syntax issue because now that I remember back when making my prompt, that is exactly the issue I had, dunno why I forgot. Anyway here is a prompt I made, I think its pretty usefull, it puts the path you are in above the actual prompt because I hate it when I am in a very deep directory tree and everything line wraps. Also I colorized the prompt to yellow for regular users and red for root just so I remember not to do anything stupid as root. Toss all of this into your
~/.bash_profile or
~/.profile.
Code:
function my_prompt_command {
local WHITE=`echo -e "\033[1;37m\c"`
local BLUE=`echo -e "\033[1;34m\c"`
local GREEN=`echo -e "\033[1;32m\c]"`
local DOWNBRACK=`echo -e "\033(0\154\161\033(B\c"`
local PWD=`pwd`
#echo -e "$WHITE$DOWNBRACK($PWD)"
echo -e "$WHITE($PWD)"
}
PROMPT_COMMAND=my_prompt_command
function fluxprompt {
local WHITE="\[\033[1;37m\]"
local CYAN="\[\033[1;36m\]"
local YELLOW="\[\033[1;33m\]"
local RED="\[\033[1;31m\]"
local NO_COLOR="\[\033[0m\]"
local UPBRACK=`echo -e "\[\033(0\155\161\033(B\c\]"`
case $TERM in
xterm*|rxvt*|Eterm*)
TITLEBAR='\[\033]0;\u@\h:\w\007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="$TITLEBAR\
$WHITE[\
$YELLOW\u@\h\
$WHITE]\
$NO_COLOR\\$ "
}
fluxprompt
It ends up looking something like this:
Code:
(/usr/share/sendmail/cf/cf)
[root@maximus]#
To make it red for root simply change the line near the bottom that says
Code:
$YELLOW\u@\h\
to
$RED\u@\h\
Also, for all you bash guru's out there, if you notice in my prompt I have commented out the line in function fluxprompt {} section.
Code:
#echo -e "$WHITE$DOWNBRACK($PWD)"
When I made this prompt back when I was using Mandrake 9.2, this made a nice little ASCI bracket and I used a similar one called UPBRACK in the PS1 var to connect them together, it approximatly looks like this.
Code:
_
| (/usr/share/sendmail/cf/cf)
|_[root@maximus]#
Well the reason I commented them out was because in Slackware 9.1/10 it outputs the letters 'lq' and 'mq' instead of the nice little brackets and looks like this:
Code:
lq(/usr/share/sendmail/cf/cf)
mq[root@maximus]#
The odd thing is when I ssh into my box with PuTTY, I see the nice brakets . If sombody could shed some light as to why this is I would appreciate it. Thanks