Wednesday, August 22, 2007

using the linux yes command

One quick way of sending set of character to standard output repeatedly is using the linux command yes.


Here's how to print string of words repeatedly from your screen.


Prints words 10 times

# yes VeRTITO | head -10
~~~~~~~~~~~~~~~~
VeRTiTO
VeRTiTO
VeRTiTO
VeRTiTO
VeRTiTO
VeRTiTO
VeRTiTO
VeRTiTO
VeRTiTO
VeRTiTO
~~~~~~~~~~~~~~~~

Prints 999 times.

# yes 999 Too many | head -999
~~~~~~~~~~~~~~~~
Too many
Too many
Too many
Too many
....
~~~~~~~~~~~~~~~~


To print words forever would be

# yes This is forever

'This is forever' would be printed repeatedly until terminated.

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy