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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting Text to bold in a Unix Korn shell script on Solaris

Status
Not open for further replies.

h2hummer47

Technical User
Dec 11, 2002
7
US
I want the certain text in a do-loop script to print in bold letters

do
rsh $host: 'date +%d %h 20%y %T'


I want the above line to print in bold lettering. Any suggestion will help.
 
man tput

#------------- from 'man tput'-----------------------
The next example sets the shell variables bold, to begin
stand-out mode sequence, and offbold, to end standout mode
sequence, for the current terminal. This might be followed
by a prompt:

echo "${bold}Please type in your name: ${offbold}\c"
example% bold='tput smso'
example% offbold='tput rmso'
vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Hi:

Vlad's tput solution is best, but you might find it an interesting technical exercise to play with escape sequences. In vi, create the BOLD_TYPE esape sequence by

pressing control-v, and then press the escape character followed by [1m&quot;.


#!/bin/ksh

BOLD_TYPE=&quot;^[[1m&quot;
NORMAL_TYPE=&quot;^[[0m&quot;
INVERSE_TYPE=&quot;^[[7m&quot;

# tested with solaris 7
echo $INVERSE_TYPE # print inverse
echo &quot;line 1&quot;
echo &quot;line 2&quot;

echo $NORMAL_TYPE # go back to normal
echo &quot;line 3&quot;
echo &quot;line 4&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top