- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Change Title on Xterm or dtterm
Operating System - HP-UX
1754392
Members
2721
Online
108813
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-12-2002 05:35 AM
тАО08-12-2002 05:35 AM
Change Title on Xterm or dtterm
Found this cool website, just thoght i'd share it with you.
http://www.shelldorado.com/
My Favorite script changes the title of the dtterm or xterm window with the current pwd! Useful if you have loads of windows minimized!
Thanks www.shelldorado.com, keep up the hard work.
Script below
if [ "$TERM" = xterm ] || [ "$TERM" = dtterm ]; then
alias cd=Xcd
Xcd ()
{
if [ $# -ne 0 ]; then
'cd' "$@"
else
'cd'
fi
NAME="$(uname -n):${PWD}"
# reset name of xterm title bar & icon to $NAME
echo "\033]0;${NAME}\007\c" # set title bar & icon
}
Xcd .
elif [ "$TERM" = hpterm ]; then
alias cd=Hcd
Hcd ()
{
if [ $# -ne 0 ]; then
'cd' "$@"
else
'cd'
fi
NAME="$(uname -n):${PWD}"
LEN=`echo "$NAME\c" | wc -c`
# reset name of hpterm title bar & icon to $NAME
echo "\033&f0k${LEN}D${NAME}\c" # set title bar
echo "\033&f-1k${LEN}D${NAME}\c" # set icon
}
Hcd .
fi
http://www.shelldorado.com/
My Favorite script changes the title of the dtterm or xterm window with the current pwd! Useful if you have loads of windows minimized!
Thanks www.shelldorado.com, keep up the hard work.
Script below
if [ "$TERM" = xterm ] || [ "$TERM" = dtterm ]; then
alias cd=Xcd
Xcd ()
{
if [ $# -ne 0 ]; then
'cd' "$@"
else
'cd'
fi
NAME="$(uname -n):${PWD}"
# reset name of xterm title bar & icon to $NAME
echo "\033]0;${NAME}\007\c" # set title bar & icon
}
Xcd .
elif [ "$TERM" = hpterm ]; then
alias cd=Hcd
Hcd ()
{
if [ $# -ne 0 ]; then
'cd' "$@"
else
'cd'
fi
NAME="$(uname -n):${PWD}"
LEN=`echo "$NAME\c" | wc -c`
# reset name of hpterm title bar & icon to $NAME
echo "\033&f0k${LEN}D${NAME}\c" # set title bar
echo "\033&f-1k${LEN}D${NAME}\c" # set icon
}
Hcd .
fi
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-04-2003 10:29 AM
тАО11-04-2003 10:29 AM
Re: Change Title on Xterm or dtterm
Guys,
Hoping someone can help explain the following ...
I've been using the following command placed in my .kshrc file to change the title bar within my xterm session:
PS1='^[]0;${HOSTNAME}(${UNAME}): ${PWD}^G$HOSTNAME($UNAME)$PWD> '
Which displays my host, name and working directory in the xterm title bar. This works great on all my servers (aix and hp/ux) except for root on hp/ux 11.11 witch uses /sbin/sh. As I said, this works fine on root on an ll.0 server (/sbin/sh looks to be the same between 11.0 and 11.11 .. which is why I'm confused)
In 11.11 case, when I 'set -o vi' and ESC-K or ESC-J to retrieve my commands, instead of retrieving, the cursor jumps to column one of my prompt. Again, This is only happening with /sbin/sh on root on hp/ux 11.11 servers.
Thanks for any pointers ...
Hoping someone can help explain the following ...
I've been using the following command placed in my .kshrc file to change the title bar within my xterm session:
PS1='^[]0;${HOSTNAME}(${UNAME}): ${PWD}^G$HOSTNAME($UNAME)$PWD> '
Which displays my host, name and working directory in the xterm title bar. This works great on all my servers (aix and hp/ux) except for root on hp/ux 11.11 witch uses /sbin/sh. As I said, this works fine on root on an ll.0 server (/sbin/sh looks to be the same between 11.0 and 11.11 .. which is why I'm confused)
In 11.11 case, when I 'set -o vi' and ESC-K or ESC-J to retrieve my commands, instead of retrieving, the cursor jumps to column one of my prompt. Again, This is only happening with /sbin/sh on root on hp/ux 11.11 servers.
Thanks for any pointers ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-05-2003 01:08 AM
тАО11-05-2003 01:08 AM
Re: Change Title on Xterm or dtterm
The problem is caused by the length of your prompt... The shell tries to calculate where your cursor is on the line of your terminal, but doesn't know that part of your prompt is not displayed on the command line.
What you can do to solve this is put a CTRL-M between the end of the escape sequence and the rest (visible) part of the prompt.
What I did was the following:
PS1=$(settitle `hostname`:'${PWD}')^M`hostname`':${PWD}$ '
(on one line of course, and the ^M is in real life a CTRL-M) and this works. What you then need is a script like the one posted to have it active. Or the simple version I have here:
case $TERM in
xterm|dtterm)
echo "\033]0;$1\007\c"
;;
hp*)
echo "\033&f0k${#1}D$1\c"
;;
*)
;;
esac
What you can do to solve this is put a CTRL-M between the end of the escape sequence and the rest (visible) part of the prompt.
What I did was the following:
PS1=$(settitle `hostname`:'${PWD}')^M`hostname`':${PWD}$ '
(on one line of course, and the ^M is in real life a CTRL-M) and this works. What you then need is a script like the one posted to have it active. Or the simple version I have here:
case $TERM in
xterm|dtterm)
echo "\033]0;$1\007\c"
;;
hp*)
echo "\033&f0k${#1}D$1\c"
;;
*)
;;
esac
Every problem has at least one solution. Only some solutions are harder to find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-05-2003 07:00 AM
тАО11-05-2003 07:00 AM
Re: Change Title on Xterm or dtterm
Elmar .. THANKS! That was it ...
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP