Skip to content

Instantly share code, notes, and snippets.

@eigenfoo
Last active September 13, 2017 02:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eigenfoo/6147d32f5ad2641fb0a7e15b49cbf3d2 to your computer and use it in GitHub Desktop.
Save eigenfoo/6147d32f5ad2641fb0a7e15b49cbf3d2 to your computer and use it in GitHub Desktop.
shell script for some command line fun
#!/bin/bash
# Dependencies: fortune, cowsay, lolcat and coreutils
# brew install fortune cowsay lolcat coreutils
# Directory where the ASCII art is
cowfiledir='/usr/local/Cellar/cowsay/3.04/share/cows/'
randfile=$(ls $cowfiledir/*.cow | gshuf -n 1)
basefile=$(basename $randfile)
cowarg=${basefile%.*}
arr[0]='b'
arr[1]='d'
arr[2]='g'
arr[3]='p'
arr[4]='s'
arr[5]='t'
arr[6]='w'
arr[7]='y'
randeye=$[$RANDOM % 8]
fortune -a | cowsay -${arr[$randeye]}nf $cowarg | lolcat
@eigenfoo
Copy link
Author

eigenfoo commented Sep 10, 2017

Picks a fortune (allowing for offensive fortunes), picks a random ASCII art "cow" to say the fortune in a speech bubble, as well as a random eye pattern for the "cow", and colorizes it.

Works for Mac OS: for Linux systems, simply change gshuf to shuf on line 7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment