Last active
September 13, 2017 02:51
-
-
Save eigenfoo/6147d32f5ad2641fb0a7e15b49cbf3d2 to your computer and use it in GitHub Desktop.
shell script for some command line fun
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
toshuf
on line 7