index | misc

A bot to “dent” the poetry of Matthew Arnold, line by line, to

This “bot” consists of three files, and a cronjob.


Matthew Arnold

  • a plain text file containing all of the poetry of Matthew Arnold.
  • a config file bearing only the current line number
  • the bash script that reads the line and sends the “dent” (update) to


I just have this in my crontab

  0 * * * * /path/to/mattUP

This runs the script every hour.


Here's the script (which I have named “mattUP”):

# dent the entire poetic works of Matthew Arnold
# by tony baldwin |
# what line are we on? read from the config file
source mattline.cfg
# grab the line from the text file
ud=$(sed -n  $myline mattarnoldpoems.txt)
# send the update
curl -u mattbot:********* -d "status=$ud&source=mattBot" \
# rewrite the config file, incrementing the line number by 1
# the poetry file has 14222 lines, so, when we reach 14222
# we will start all over, resetting to line 1.
if [[ $myline = 14222 ]]; then
	newline=$((line + 1))
echo line=$newline > mattline.cfg


The mattline.cfg file is very simple. It looks like this:


initially, and then each time the script is run, it increments the value by 1, and rewrites the file.


And the poetry file, mattarnoldpoems.txt, is just a simple, plain text file, with all of Matthew Arnold's poetic works, line by line, with no empty lines.


Download mattbot:

Why would you want to download mattbot?
Well, you could use it as an example to set up a bot to post the poetry of, say, William Butler Yeats, or T.S. Eliot.

O, si quieres, se puede hacer el mismo con la poesia de Pablo Neruda.

Or, maybe you'd like to dent or tweet The Constitution of the United States of America.

If you set up any of these, or something else cool, be sure to comment below and let me know all about it.

in action

See the mattbot in action at

shortlink to this page:

tonybaldwin 2012.