🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #561

Bash example for xterm users

#561
From: bothner
Date: Sat, 09 Sep 1989 00:39
29 lines
1254 bytes
Xterm users may want to add something like the following to their
.bashrc. It sets the working directory and hostname in the title bar,
and writes the prompt with underlining.
Also, the function 'setname' changes the icon name, and the
prefix of the title bar.
Note that what may look like ^[ and ^G are <Escape> and <Bell>.
Brian, you are welcome to include this (or something similar)
in the examples directory.
	--Per

if [ "$PS1" ]; then

  # Set xterm "name" of terminal, and update icon name.
  function setname {
     TERMNAME="$*"
     if [ "$TERM" = "xterm" ]; then echo -n "]1;${TERMNAME}"; fi
  }

  if [ ! "$LOGIN_SHELL" ]; then
    if [ "$TERM" = "xterm" ]; then
      if [ ! "$TERMNAME" ]; then TERMNAME=xterm; fi
      # Set xterm title bar name.
      PS1=']2;${TERMNAME}: \w@\h[4m\h<\!>[0m'
    else
      PS1='\h:\w[\!] '
    fi
  fi

fi
Technical Details
Message-ID: <8909090039.AA07265@gilroy.pa.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!WSL.DEC.COM!bothner

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!WSL.DEC.COM!bothner
From: bothner@WSL.DEC.COM
Newsgroups: gnu.bash.bug
Subject: Bash example for xterm users
Message-ID: <8909090039.AA07265@gilroy.pa.dec.com>
Date: 9 Sep 89 00:39:16 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 29