- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Text formatting is script
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
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
02-02-2006 01:20 PM
02-02-2006 01:20 PM
Text formatting is script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2006 01:33 PM
02-02-2006 01:33 PM
Re: Text formatting is script
Here is an example:
BOLDDARKGRAY=$(tput bold; tput setaf 0)
LIGHTGRAY=$(tput setaf 7)
echo "${BOLDDARKGRAY}Mickey Mouse"
echo "${LIGHTGRAY}Donald Duck"
Generally the "smso" and "rmso" (start standout mode and remove standout mode) are the two sequences that you can count on a terminal having. The setaf sequences may or may not be available; it depends upon the terminfo entry. The good news is that if a sequence is undefined a null string is returned so you can still output it safely if the feature is unsupported. You can also use terminfo sequences to clear the screeen and position the cursor.
Man tput and terminfo for details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2006 01:39 PM
02-02-2006 01:39 PM
Re: Text formatting is script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2006 01:50 PM
02-02-2006 01:50 PM
Re: Text formatting is script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2006 01:52 PM
02-02-2006 01:52 PM
Re: Text formatting is script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2006 01:54 PM
02-02-2006 01:54 PM
Re: Text formatting is script
hpprod:/home/mayub/script :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2006 01:58 PM
02-02-2006 01:58 PM
Re: Text formatting is script
If you are running on a PC, the question still depends on the program you are using to display text. Now the easy answer is to check the man page for terminfo and tput. The following will display several character enhancements:
eval $(ttytype -s)
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 "\t$EE SGR0 $IV BOLD $EE$HB DIM $EE$BL BLINK $EE$HV SMSO $EE$UL SMUL $EE"
Now these enhancements are monochrome (one color, typically white and gray), but some terminal emulators can represent an enhancement with color too.
However, color (specific colors) can be quite complex. Check the terminfo man page, specifically the section on color manipulation. There are hard coded escape sequences that will work with xterm but they completely fail with hpterm and other emulators. That's why the curses library and the terminfo database were created to provide portability.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2006 02:01 PM
02-02-2006 02:01 PM
Re: Text formatting is script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2006 05:17 PM
02-02-2006 05:17 PM
Re: Text formatting is script
--
Muthu