Write a program that is a sonnet, and when run prints out a sonnet.

By "sonnet" I mean:

  • 14 lines
  • Each line, when read aloud, has 10 syllables

Symbols can be ignored, or pronounced in whatever reasonable way you want.

Popularity contest, most upvotes wins.


1 Answer 1


Linux shell script

Cheating, I know.

Edit: a version that rhymes:

(Thanks @professorfish for the idea of using the options of cat)

#!/bin/cat -bAse
In thee thy summer, ere thou be distilled:
Make sweet some vial; treasure thou some place
With beauty's treasure ere it be self-killed.
That use is not forbidden usury,
Which happies those that pay the willing loan;
That's for thy self to breed another thee,
Or ten times happier, be it ten for one;
Ten times thy self were happier than thou art,
If ten of thine ten times refigured thee:
Then what could death do if thou shouldst depart,
Leaving thee living in posterity?
   Be not self-willed, for thou art much too fair
   To be death's conquest and make worms thine heir.

First line pronounced as "shebang slash bin slash cat negative base". The line numbers and $ in the output are to be ignored when reading aloud.

Taken from Shakespeare's Sonnet VI.

Old version:

#!/usr/bin/env cat
For slander's mark was ever yet the fair;
The ornament of beauty is suspect,
A crow that flies in heaven's sweetest air.
So thou be good, slander doth but approve
Thy worth the greater, being wooed of time;
For canker vice the sweetest buds doth love,
And thou present'st a pure unstained prime.
Thou hast passed by the ambush of young days
Either not assailed, or victor being charged;
Yet this thy praise cannot be so thy praise,
To tie up envy, evermore enlarged,
   If some suspect of ill masked not thy show,
   Then thou alone kingdoms of hearts shouldst owe.

First line pronounced as "she-bang slash use-r slash bin slash env cat".

Taken from Shakespeare's Sonnet LXX.

  • \$\begingroup\$ Hmm, cat doesn't seem to rhyme with any of the other lines though... \$\endgroup\$
    – Kyle Kanos
    May 29, 2014 at 1:49
  • \$\begingroup\$ @KyleKanos Rhyming is not a requirement listed by the OP. And among all the Shakespeare sonnets, this is the closest to a rhyme (cat and suspect). \$\endgroup\$
    – user12205
    May 29, 2014 at 2:48
  • \$\begingroup\$ @ace can't you use #!/bin/cat? also, you can add some random options to cat to make it rhyme \$\endgroup\$
    – user16402
    May 29, 2014 at 9:48
  • \$\begingroup\$ I am certain that the definition of "sonnet" includes the particular rhyming scheme. However, I do acknowledge that OP changed the definition of sonnet to mean something slightly less strict. \$\endgroup\$
    – Kyle Kanos
    May 29, 2014 at 12:38
  • 1
    \$\begingroup\$ Alternative rhyming first lines would be #!/bin/cat -uuA (dash u u a) with sonnet 16, 18, 32, ...; or ... -AbusE (minus abuse) with sonnet 21, or -uuV with sonnet 43 or 52; or -uus with 59 and a South African accent... \$\endgroup\$ May 29, 2014 at 13:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.