

Date: November 12, 1999
Highlighting text on computer terminals is useful for drawing attention to important information. To highlight text on ASCII terminals and telnet sessions, use the "tput" command. The types of highting available with "tput" includes blinking, bold, reverse, underline and screen clear.**.
The attached "today" script uses the "tput" command to highlight today's date in the output of the "cal" command, as illustrated below.
July 1999
Sun Mon Tue Wed Thu Fri Sat
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
#!/usr/bin/ksh
# Script Name: today
# v1.0 Calendar with today's date highlighted
# Bruce Spencer, IBM
# tput commands to control highlighting
# note: some terminals do not support all tput options
RVR=`tput smso` # reverse
END_RVR=`tput rmso` # end reverse
BLNK=`tput blink` # blink
UNDER=`tput smul` # underline
END_UNDER=`tput rmul` # underline
CLEAR=`tput clear` # clear screen
BELL=`tput bel` # bell sound
BOLD=`tput bold` # bold
DIM=`tput dim` # dim
INVIS=`tput invis` # invisible
END=`tput sgr0` # turn off dim, blink, bold, dim, invisible
# Clear Screen
echo ${CLEAR}
# Convert month abbreviation to month number
set `date`
case ${2} in
Jan) MONTH=1;;
Feb) MONTH=2;;
Mar) MONTH=3;;
Apr) MONTH=4;;
May) MONTH=5;;
Jun) MONTH=6;;
Jul) MONTH=7;;
Aug) MONTH=8;;
Sep) MONTH=9;;
Oct) MONTH=10;;
Nov) MONTH=11;;
Dec) MONTH=12;;
*) MONTH=0;;
esac
DAY=`echo ${3} | sed "s/^0//"`
cal $MONTH ${6} | sed "s/ ${DAY}/ ${RVR}${DAY}${END_RVR}/"
# Examples of different formatting
# echo "${UNDER}Underline: Happy Thanksgiving!${END_UNDER}"
# echo "${BOLD}Bold: Happy Thanksgiving!${END}"
# echo "${DIM}Dim: Happy Thanksgiving!${END}"
# echo "${BELL}BELL: Happy Thanksgiving!${END}"
# echo "${INVIS}Invisible: Happy Thanksgiving!${END}"
# echo "${BLINK}Blink: Happy Thanksgiving!${END}"