Sunday, February 6, 2011

Fortune for you!!

Almost all linux users are familiar with the fortune program. For new users, here is a small snippet:

Name:
fortune - print a random, hopefully interesting, adage

Description from the man page:
When fortune is run with no arguments it prints out a random epigram. Epigrams are divided into several categories.

Well, in order to fully utilize the program, I went ahead and wrote a small script that automatically displayed a random fortune everytime I logged in. Here is the script and all it requires is the notification daemon to be installed for your particular wm.

#!/bin/bash
sleep 3
notify-send "Hello $(whoami), Your Daily Fortune..." "$(fortune)"

Save it as fortune.sh and mark it as executable by:

chmod +x fortune.sh

and just add it to the post login scripts in your particular wm, openbox in my case so '~/.config/openbox/autostart.sh'

No comments: