Re: Prompt in Bash
Ask and ye shall receive :> This is a cut-down version of my bashrc.
It also shows a trick to get around the problem with some shells
actually being login shells, but not calling .bash_login (i.e. X login
shells). I just symlink my .bash_login to my .bashrc, and let .bashrc
handle figuring out what kind of shell it is (see BASH_INITIALIZED
below).
if [ ${PS1:-UNSET} = UNSET ]
then
INTERACTIVE_SHELL=F
else
INTERACTIVE_SHELL=T
if [ "$TERM" = xterm -o "$TERM" = rxvt ]
then
set_titlebar () { echo -n "]2;$*"; }
export -f set_titlebar
my_dirname () {
if [ "${PWD#$HOME}" != "$PWD" ]
then
echo '~'${PWD#$HOME}
else
echo $PWD
fi
}
export -f my_dirname
export PS1='\n\!\$ '
export PROMPT_COMMAND='eval set_titlebar `whoami`@`hostname`:`my_dirname`'
else
export PS1='\n\u@\h:\w\n\!\$ '
fi
fi
if [ "${BASH_INITIALIZED}" != "Yes" ]
then
export BASH_INITIALIZED=Yes
# Do other stuff here that should only happen once, and be
# inherited by sub-shells.
fi
--
Rob
--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org .
Trouble? e-mail to templin@bucknell.edu .
Reply to: