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
1
$ fortune | <a class=\"zem_slink freebase/en/cowsay\" title=\"Cowsay\" rel=\"homepage\" href=\"http://www.nog.net/%7Etony/warez/cowsay.shtml\">cowsay</a> -f tux

Let Tux bring the fortune cookie

\"commandlinefu.com\"

by David Winterbottom (codeinthehole.com)

\"\"

Now, for some fun

#!/bin/bash –
#===============================================================================
#
#          FILE:  fortune_cowsay.sh
#
#         USAGE:  ./fortune_cowsay.sh
#
#   DESCRIPTION:  Cowsay with random cow file.. 🙂
#
#       OPTIONS:  —
#  REQUIREMENTS:  —
#          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\’ \’ \’` )
count=${#array}
random=$((RANDOM%count))

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

\"Reblog

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

  1. 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