bash Linux

let a cow tell you your fortune

Here\’s something that I saw on commandlinefu yesterday. That sent me thinking about some command to have the cow file picked randomly 🙂 So, here\’s the original command from the commandlinefu:
let a cow tell you your fortune
$ fortune | <a class="zem_slink freebase/en/cowsay" title="Cowsay" rel="homepage" href="">cowsay</a> -f tux

Let Tux bring the fortune cookie


by David Winterbottom (


[link to original | source: All commands
Now, for some fun

#!/bin/bash –
#          FILE:
#         USAGE:  ./
#   DESCRIPTION:  Cowsay with random cow file.. 🙂
#       OPTIONS:  —
#          BUGS:  —
#         NOTES:  —
#        AUTHOR:   (),
#       COMPANY:
#       VERSION:  1.0
#       CREATED:  06/01/2010 03:25:59 PM IST
#      REVISION:  —

array=( `ls -1 /usr/share/cowsay/ |tr \’\\n\’ \’ \’` )

fortune |cowsay -f ${array[$random]%%.cow}


3 replies on “let a cow tell you your fortune”

It was extremely interesting for me to read this post. Thanx for it. I like such themes and everything that is connected to this matter. I would like to read a bit more on that blog soon. By the way, pretty good design that site has, but don’t you think design should be changed every few months?

John Stone

This site uses Akismet to reduce spam. Learn how your comment data is processed.