Skip to content

Instantly share code, notes, and snippets.

@0xjams
Created March 29, 2015 23:31
Show Gist options
  • Save 0xjams/29b2df0c54de4339d080 to your computer and use it in GitHub Desktop.
Save 0xjams/29b2df0c54de4339d080 to your computer and use it in GitHub Desktop.
Random fortune with a random format cowsay
#!/bin/bash
formats=$(cowsay -l)
words=$(echo $formats | wc -w)
format=$(($RANDOM%($words-5)))
str_format=$(echo $formats | cut -d" " -f $(($format+5)))
fortune ~/fortunes/facts_complete.dat | cowsay -f $str_format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment