[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: A very simple question



"Civ Kevin F. Havener" <havenerk@thunder.safb.af.mil> writes:

> I'll take a crack at this one since I've asked and received an answer to 
> the very same question.
> 
> I use a two-line prompt that tells me who I'm logged on as and at what 
> machine on the first line and what is the full path to the current directory.
> Put this in your ~/.bash_profile or in /etc/profile (for system-wide 
> default):  PS1='<\u@\h>\n<`pwd`>\$ '

Here's another option (from my .bashrc) that works with rxvt's (and
xterms?).  It dynamically sets the title bar to user@machine:pwd so
you don't have to have it all on the prompt.  If you're not using an
xterm/rxvt, it sets the prompt instead.  It also does /home/username
-> ~ translation when appropriate.

if [ ${PS1:-UNSET} = UNSET ]
then
	INTERACTIVE_SHELL=F
else
	INTERACTIVE_SHELL=T

  if [ "$TERM" = x"term" ]
  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


--
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: