Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nice & usefull xwindow title

Status
Not open for further replies.

Truusvlugindewind

Programmer
Jun 5, 2002
350
NL
Linux bash has the env.var PROMPT_COMMAND. You can set is in your .profile e.g:
Code:
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
In your xterm or PuTTy your window title will display "user@hostname:current directory". When you cd to antoher dir the title will be updated.
When you ssh to another linux machine (with PROMP_COMMAND set) you'll see everything updated! Very nice.

When you ssh to a "real" unix/ksh machine.... no go :(
The linux behavious cannot be accomplished. But a nice bypass in your .profile
Code:
echo "\033]0;$(uname -n)($(whoami))\007"
.
This will bring "hostname(user)" in the title. Only once. An updated directory cannot be done. But, that's part of our PS1, isitnot?
When you access multiple machines this is a very nice option.
 
Not a Linux person myself (still learning), but for HPUX try puting the following lines to your .profile

# Set up custom prompt
PS1="
$(/usr/bin/whoami)@$(/usr/bin/hostname)
[\$PW]
$ "
 
Not a Linux person myself (still learning), but for HPUX try puting the following lines to your .profile

# Set up custom prompt
PS1="
$(/usr/bin/whoami)@$(/usr/bin/hostname)
[\$PW]
$ "

Totally different thing hes accomplishing. PS1 sets the prompt value, whereas what he is talking about (PROMPT_COMMAND) sets the window title.

___________________________________
[morse]--... ...--[/morse], Eric.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top