Operating System - HP-UX
1752536 Members
5116 Online
108788 Solutions
New Discussion юеВ

Re: Making text flash in a shell script

 
Tony Mancini
Occasional Contributor

Making text flash in a shell script

Folks, anyone got any ideas on how to make text flash in a shell script?
6 REPLIES 6
Peter Kloetgen
Esteemed Contributor

Re: Making text flash in a shell script

Hi,

you are looking for a way to make a text flashing in the output of a shell script?

--> man tput

this command is able to do so:

tput bold

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Peter Kloetgen
Esteemed Contributor

Re: Making text flash in a shell script

Hi again Tony,

i forgot to mention how to turn off flashing text:

tput rmso

You can also invert the output of a script using:

tput smso (turn inverting on)

tput rmso (turn inverting off)

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Nick Wickens
Respected Contributor

Re: Making text flash in a shell script

I think Peter meant to say tput blink rather than tput bold.
Hats ? We don't need no stinkin' hats !!
Sukant Naik
Trusted Contributor

Re: Making text flash in a shell script

Hi,

You can do it as shown below.

tput clear
bold='tput smso'
offbold='tput rmso'
blink='tput blink'

echo "${blink} This is Sukant here ${offbold}"

Who dares he wins
Peter Kloetgen
Esteemed Contributor

Re: Making text flash in a shell script

Hi Tony,

sorry, of course Nick and Sukant are right, tput blink for blinking text is correct, i thought you wanted a text more bright than normal. My english is too bad sometimes.....

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Bill Hassell
Honored Contributor

Re: Making text flash in a shell script

Here is a set of the most common display enhancements:

export HB=$(tput dim) # dim text
export HV=$(tput smso) # 1/2 bright inverse
export IV=$(tput bold) # inverse
export UL=$(tput smul) # underline
export BL=$(tput blink) # blink
export EE=$(tput sgr0) # end all enhancements

For example:

print "Normal $HB dim $HV halfbrite inverse $IV inverse $UL underline $BL blink $EE normal"

And a couple of others:

CLEARALL=$(tput khome;tput clear)
FKEYSOFF=$(tput rmln)
TTYRESET=$(tput reset)

CLEARALL will erase all of terminal memory including pages above the top of the display (the clear command only clears visible memory). FKEYSOFF turns off the function key display on terminals with usable function keys. TTYRESET is a good way to start a new login as it resets any strangeness in the terminal settings.

NOTE: tput is a scripting interface to the curses library and allows you to specify terminal features WITHOUT coding special escape sequences. However, there are hundreds of terminals (and PC emulators), many of which are incompatible with each other and many do not have all of the above features. The advantage of tput is that if the terminal does not support a feature, the result is a null string. HP terminals (and emulators such as hpterm) support all these features (actually, hpterm does not blink).



Bill Hassell, sysadmin