Re: pwd in the terminal title



On Tue, 2005-01-04 at 08:03 +0300, regatta wrote:
> Hi
> 
> Anyone know how can I make the terminal display the working directory
> in the title ?

I have this in my .bashrc - it works for all xterm-like apps that
support the extension.

# If this is an xterm set the title to "user host: dir"
case $TERM in
  xterm*)
    PROMPT_COMMAND='echo -ne "\033]0;${USER} ${HOSTNAME}: ${PWD}\007"'
      ;;
  *)
      ;;
esac

The escape sequence used can unfortunately crash some terminal emulators
that weren't coded properly to handle "erroneous" escape sequences
(personally, I'd consider that a fairly serious security hole in the
terminal emulator, since it probably means that any app that can display
text to the terminal window can crash it and/or take it over, which
could for example allow certain remote apps to take over your machine).




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