Skip to content

Instantly share code, notes, and snippets.

@afrase
Created June 12, 2015 20:12
Show Gist options
  • Save afrase/27074b6a681de8233041 to your computer and use it in GitHub Desktop.
Save afrase/27074b6a681de8233041 to your computer and use it in GitHub Desktop.
#!/bin/bash
FORTUNES_BIN=$(which fortune)
COWSAY_BIN=$(which cowsay)
# on ubuntu you have to have `force_color_prompt=yes' set if you want to see
# all the pretty colors.
LOLCAT_BIN=$(which lolcat)
if [ -z "$FORTUNES_BIN" ] || [ -z "$COWSAY_BIN" ]; then
# just exit normally so we don't screw with the motd
exit 0
fi
# these are all the fortunes that get installed with
# `fortune-mod' and `fortune-off' on ubuntu.
# just uncomment the ones you want to have randomly chosen from.
FORTUNES=(
# art
# ascii-art
# computers
# cookie
# debian
# definitions
# disclaimer
# drugs
# education
# ethnic
# food
# fortunes
# goedel
# humorists
# kids
# knghtbrd
# law
# linux
# linuxcookie
# literature
# love
# magic
# medicine
# men-women
# miscellaneous
# news
# paradoxum
# people
# perl
# pets
# platitudes
# politics
# pratchett
# riddles
# science
# songs-poems
# sports
# startrek
# tao
# translate-me
# wisdom
# work
# zippy
#####################
# offensive fortunes
#####################
# astrology
# atheism
# black-humor
# hphobia
# limerick
# misandry
# misogyny
# privates
# racism
# religion
# sex
# vulgarity
)
# all the different cow types
COWS=(
# apt
# beavis.zen
# bong
# bud-frogs
# bunny
# calvin
# cheese
# cock
# cower
# daemon
default
# dragon
# dragon-and-cow
# duck
# elephant
# elephant-in-snake
# eyes
# flaming-sheep
# ghostbusters
# gnu
# head-in
# hellokitty
# kiss
# kitty
# koala
# kosh
# luke-koala
# mech-and-cow
# meow
# milk
# moofasa
# moose
# mutilated
# pony
# pony-smaller
# ren
# sheep
# skeleton
# snowman
# sodomized-sheep
# stegosaurus
# stimpy
# suse
# three-eyes
# turkey
# turtle
# tux
# unipony
# unipony-smaller
# vader
# vader-koala
# www
)
# different "modes" to apply to each cow
COW_MODES=(
# borg
"-b"
# dead cow
"-d"
# greedy
"-g"
# paranoid
"-p"
# stoned
"-s"
# tired
"-t"
# wired
"-w"
# young
"-y"
)
# Seed random generator
RANDOM=$$$(date +%s)
# randomly select a cow from the COW array
THE_COW=${COWS[$RANDOM % ${#COWS[@]}]}
echo
if [ -n "$LOLCAT_BIN" ]; then
echo $("$FORTUNES_BIN" -a "${FORTUNES[@]}") | $COWSAY_BIN -f $THE_COW | $LOLCAT_BIN
else
echo $("$FORTUNES_BIN" -a "${FORTUNES[@]}") | $COWSAY_BIN -f $THE_COW
fi
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment