- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell colour
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
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
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
05-19-2005 02:03 AM
05-19-2005 02:03 AM
Shell colour
I like to do some fancy stuff. Is there any way to give colours to echo messages from shell scripts .
Are there any tput or any escape sequences available .
I have seen some one did the same in SCO Unix . Is it possible in HP ?
Thanks in Advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 02:26 AM
05-19-2005 02:26 AM
Re: Shell colour
Do not see the same in HPUX though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 02:40 AM
05-19-2005 02:40 AM
Re: Shell colour
i dont whether it will work in HP, but it works for me in linux console
echo -en "\E[$c1;$c2m" followed by the text
where $c1 and $c2 are numeric values which sets color.
to reset you can do 'tput sgr0'
Hope this helps,
Gopi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 02:45 AM
05-19-2005 02:45 AM
Re: Shell colour
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 03:25 AM
05-19-2005 03:25 AM
Re: Shell colour
The way these codes is interpreted is a function of your shell and the Terminal characteristics. Most notably -- if you're using VT52, VT100, VT102 and some color_xterm variations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 08:04 AM
05-19-2005 08:04 AM
Re: Shell colour
So you start by reading about your terminal emulator. It's important to understand the differences between a PC running an Xwindow emulator versus running a terminal emulator (like Hyperterminal). Xwindows does not have any terminal emulator. Instead, you login to a remote system and 'steal' a copy of xterm or dtterm or hpterm and redisplay the results back to your screen. Your emulator is the program you are running and has little to do with the PC.
Color is usually defined (in a compatible manner) with the terminfo database and the Curses library. The primary tool is tput (to display or set features) and untic will show you what a particular terminal knows how to do. After you look at man terminfo, you'll realize that there is a *lot* to fancy terminal features.
Now some emulators (like WRQ's Reflection) will implement a color map to add additional cues for what are monochrome enhancements like blink and underline, etc. You can use this short script to display the most common enhancements:
HB=$(tput dim) # dim text
HV=$(tput smso) # 1/2 bright inverse
IV=$(tput bold) # inverse
UL=$(tput smul) # underline
BL=$(tput blink) # blink
EE=$(tput sgr0) # end enhancements
echo
echo "Typical names:"
echo "\t$EE Normal $IV Inverse $EE$HB Dim $EE$BL Blink $EE$HV halfbrite $EE$UL underline $EE"
echo
echo "Curses capname (tput)"
echo "\t$EE SGR0 $IV BOLD $EE$HB DIM $EE$BL BLINK $EE$HV SMSO $EE$UL SMUL $EE"
echo
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 09:46 AM
05-19-2005 09:46 AM
Re: Shell colour
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 09:04 PM
05-19-2005 09:04 PM
Re: Shell colour
like;
PS1="`tput bold`$(hostname):`tput rmso`\$PWD\#"
it makes my hostnames bold when i connect
via telnet
Good Luck,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2005 10:54 PM
05-19-2005 10:54 PM
Re: Shell colour
U can try 'tput setaf #'
where # is a number
0 - black
1 - red
2 - green
and so on.
As written, it all depends on your settings, but it works for me on my HPUX-Box