- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- change clours in telnet session
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
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
Discussion Boards
Community
Resources
Forums
Blogs
- 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
тАО12-11-2000 05:13 AM
тАО12-11-2000 05:13 AM
change clours in telnet session
telnet session in response to a command to a script or
the contents of an environment variable? The interactive
work I do depends on a few environment variables; I
change them with a script.
I would like an un-avoidable visual reminder of which environment I am in.
I am using Reflection for Unix as my telnet application (in case that matters).
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2000 05:47 AM
тАО12-11-2000 05:47 AM
Re: change clours in telnet session
As I don't have any Reflection software at hand it will be impossible to give you an accurate response.
Anyway, if you have the ability to change the color of your screen/characters, it will most probably be through an 'Escape Sequence' for which you should find all information in the Reflection user manual.
Outputting an escape sequence from a script, is as simple as an 'echo' or 'print' statement, which will look like
echo "\033[xxxxx\c"
where \033 is the escape character and \c prevents outputting a newline (mandatory, otherwise your cursor will change location)
That's about all I can say, It's not much but could be a starting point for you.
Best regards,
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2000 08:56 AM
тАО12-11-2000 08:56 AM
Re: change clours in telnet session
PS1=`whoami`:`hostname`\>:
so when I am logged into my primary box called L1000 as root the prompt looks like this:
root:L1000>:
RD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2000 09:07 AM
тАО12-11-2000 09:07 AM
Re: change clours in telnet session
I have managed to change to inverse video this way.
Colours are not working (yet)
Richard
I have changed the prompt already, but that is still
overlooked, specially when logged-in in multiple telnet
sessions.
Anyone else any suggestions?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2000 09:25 AM
тАО12-11-2000 09:25 AM
Re: change clours in telnet session
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2000 09:52 AM
тАО12-11-2000 09:52 AM
Re: change clours in telnet session
I'm not sure how Reflection will handle it but you may want to check out the tput(1) an untic(1m) commands and the terminfo(4) database.
--Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2000 10:56 AM
тАО12-11-2000 10:56 AM
Re: change clours in telnet session
RD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-11-2000 11:58 AM
тАО12-11-2000 11:58 AM
Re: change clours in telnet session
The Reflection/1 for Windows products (hereafter referred to Rwin1) can be configured for a huge variety of colors. Depending on the version you are running (5.x, 6.x etc), you would select the menu bar item Setup then either Terminal or Display where your colrs canm be defined.
Start with a dark blue background and white letters, then change Inverse, Halfbright, Blink, etc to different colors. Try a pink backgroud with black letters or a green background with white letters, etc for each of the 5 enhancements.
Save the result and then run sam or swinstall or GlancePlus in character mode and see what a difference color makes. On a 'real' terminal, these enhancements are in monochrome, hence the advantage to using configurable enhancement colors. I like to use a different color scheme for different connections as I often have 5-10 windows open at the same time.
Now for a nifty prompt string, you can use tput to create the appropriate ESC sequences for your terminal. Here is a snippet from /etc/profile (or you can put it into .profile if you like:
# Terminal character enhancements
HB=$(/usr/bin/tput dim) # dim text
HV=$(/usr/bin/tput smso) # 1/2 bright inverse
IV=$(/usr/bin/tput bold) # inverse
NV=$(/usr/bin/tput rmso) # end smso
UL=$(/usr/bin/tput smul) # underline
EE=$(/usr/bin/tput sgr0) # end enhancements
# Setup the prompt string $PS1
if [ "$(/usr/bin/id -u)" = "0" ]
then
SUFFIX="#"
else
SUFFIX="$"
fi
HN=$(/usr/bin/hostname)
PS1='${HV}${HN} ${IV}${PWD##${PWD%/*/*}/}${EE} ${SUFFIX} '
Now this strange PS1 will produce a half-bright, inverse-video string for the hostname, and full inverse-video for the current and parent directory. Since tput pays attention to the $TERM value, you can use any terminal (or emulator) and simply set $TERM to match. For the half-bright enhancement to show up, your emulator must support that feature.
Note that several (the majority) of HP terminal information (terminfo) entries in HP-UX have the wrong code for the smso enhancement (half-bright inverse-video). Since all HP terminals built since 1979 (the HP 2640A) have this feature, you can edit the terminfo database using untic and tic to add the correct code. Here's a way to test:
TERM=hp
echo "$(tput smso) half-bright=smso $(tput bold) inverse=bold"
TERM=2392a
echo "$(tput smso) half-bright=smso $(tput bold) inverse=bold"
You can see that the halfbright enhancement changes with 2392a.
As always, your mileage will vary with non-HP terminals...some have all the enhancements, others do not. Use untic and grep to search for the features.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2000 02:45 AM
тАО12-12-2000 02:45 AM
Re: change clours in telnet session
begin with and initiate the right environment (and not
change it). The problem it that this offers the option of
'user variation'.
Bruce and Bill (second part) are on the same track as
Dan's earlier answer and are going in the direction I
want to go. Specially Bill's comprehensive answer is
appreciated (I will assign points, honestly!). But it has a
limited range appearances: I think Bill's list gives most of
the options. But I need more: at least 4 clearly different schemes, without making them difficult to read (Health
and Safety eliminates underlines, I think)
Therefore I need colours. I think Reflection/1 and
Reflection/2 are similar to Reflection for Unix; Reflection
for Unix (and Digital) is now included with Reflection/X. As
some of our friends have indicated already, it is possible
to set the colours as a configuration option on the
MSwindows side of the application. I am looking for a
way to change the colours in response to
events/scripts/commands in the Unix environment (like
tput (using terminfo) or echo "\\033[xxx\\c" (direct to
terminal) ).
Am I looking for the impossible?
I know the VT100 does not have colour, but VT320 and
VT420 do, don't they? Reflection for Unix emulates VT400.
Impossible...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2000 06:36 AM
тАО12-12-2000 06:36 AM
Re: change clours in telnet session
for COLOR in 0 1 2 3 4 5 6 7
do
echo "\033&v${COLOR}S Color $COLOR test"
done
These escape sequences modify the text in hpterm and also the background if you add video enhancements:
HB=$(/usr/bin/tput dim) # dim text
HV=$(/usr/bin/tput smso) # 1/2 bright inverse
IV=$(/usr/bin/tput bold) # inverse
for COLOR in 0 1 2 3 4 5 6 7
do
echo "\033&v${COLOR}S Color $COLOR $IV inverse $HV inverse-dim $HB dim "
done
I don't have the Reflection/X version of Reflection for Unix but if you look at the online help, it should give some details about how to control colors.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2000 07:05 AM
тАО12-12-2000 07:05 AM
Re: change clours in telnet session
#!/usr/bin/sh
typeset -i NUM=29
while [ $NUM -lt 50 ]
do
echo "\033[${NUM}mIndex $NUM is this color"
NUM=$(( NUM + 1 ))
done
echo "\033[m"
Unlike hpterm, video enhancements such as inverse) do not change the color (foreground or background). This may be what you are looking for.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-12-2000 09:27 AM
тАО12-12-2000 09:27 AM
Re: change clours in telnet session
--------------cut--------------
# cat color_text
#!/usr/bin/sh
# color_text.sh
# TERM=dtterm
# setaf for foreground color, setab for background
bla="$( tput setaf 0 )"
red="$( tput setaf 1 )"
gre="$( tput setaf 2 )"
yel="$( tput setaf 3 )"
blu="$( tput setaf 4 )"
pur="$( tput setaf 5 )"
cya="$( tput setaf 6 )"
whi="$( tput setaf 7 )"
off="$( tput sgr0 )"
print "${yel}Follow the Yellow Brick Road ${off}"
print "${gre}The grass is always greener...${off}"
print "${pur}Purple is ${red}RED ${cya}& ${blu}BLUE"
print "Good movies are ${bla}BLACK ${off}& ${whi}WHITE"
# turn off all special effects before exit (normal mode)
print "$off"
exit
--------------cut---------------------
Hope this helps,
--Bruce
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2000 01:11 AM
тАО12-13-2000 01:11 AM
Re: change clours in telnet session
(I find x-terminals a lot slower then telnet, and I still have not got to grips with cutting and pasting between MS-windows and X-windows)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2000 02:47 AM
тАО12-13-2000 02:47 AM
Re: change clours in telnet session
Hi:
Im trying Reflection for Unix and Digital.
I can change my background color following this steps:
1- In Reflection set terminal as SCO-ansi
2- Login
3- TERM=ansi50
4- tput setb 2
now my backuground is green.
Terminfo can manage color pairs too . See man terminfo.
Hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2000 03:04 AM
тАО12-13-2000 03:04 AM
Re: change clours in telnet session
That sounds very hopefull, but I tried it:
I set the terminal type in Relfection to SCO-ansi
When logging in the .profile is not setting TERM right (not your problem, my .profile !)
Here is what happened:
Gt $ export TERM=ansi50
Gt $ vi test.sh
ansi50: Unknown terminal type
[snip]
Gt $ tput setb 2
tput: unknown terminal "ansi50"
Gt $
The background has not changed.
Can you explain a bit more, so I can try to adapt it. I had a look at man terminfo, but there is too much stuff that is not relevant (there may be a 'needle in the haystack')
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2000 03:41 AM
тАО12-13-2000 03:41 AM
Re: change clours in telnet session
terminfo databases is on /usr/share/lib/terminfo/#/#term
this is /usr/share/lib/terminfo/a/ansi50
Attached file is an untic of my ansi50 terminal
Copy on your box as /tmp/ansi50.tic and run tic /tmp/ansi50.tic
Well. try now again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2000 03:44 AM
тАО12-13-2000 03:44 AM
Re: change clours in telnet session
The terminal ansi50 isn't defined in /usr/lib/terminfo/a, so it's normal that you get this message.
Set your terminal to 'ansi' and it should work.
# export TERM=ansi
and both 'vi' and 'tput' should stop complaining !
Dan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-13-2000 04:23 AM
тАО12-13-2000 04:23 AM
Re: change clours in telnet session
But in fact it dont mind.
The secrect is setb, setf, ccc ( can change color) and others entrys in compiled terminal definitions.
You can also untic you ansi and add lines for these and then tic again.
For vt400: see on terminal manual escape secuences for color background
untic vt400 > /tmp/vt400.tic
and insert that entrys
and tic /tmp/vt400.tic.
For debug you can export TERMINFO=/tmp before tic anything to be save. $TERMINFO is new path to terminfo databases.