Email yourself a new link every day

Posted on March 24, 2015

I often gather tons of links which I propose to read later, and never end up doing so. So I decided to write myself a simple utility that I could run on my server, to email me one of these.

#! /bin/bash


if [[ -r $COUNTER_FILE ]] ; then
    count=$(cat ${COUNTER_FILE})

MESSAGE=$(sed -n ${count}p $1)


echo $count > ${COUNTER_FILE}

Now, all I have to do is to add the following to my crontab…

0 14 * * * /home/user/scripts/newlink /home/user/text/links.txt | mail -s "Link for $(date +'\%d \%B \%Y')"

…and I have a fresh link every morning. Linkbait for the win.

Note: The cronjob didn’t initially work as I had expected, because % signs indicate new lines in a crontab, and have to be escaped. Good to know.

❧ Suggestions, comments, etc. can be emailed to