Skip to content

Instantly share code, notes, and snippets.

@skwid138
Last active June 23, 2020 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skwid138/ff0df971ff1d81b734fb155630f5e499 to your computer and use it in GitHub Desktop.
Save skwid138/ff0df971ff1d81b734fb155630f5e499 to your computer and use it in GitHub Desktop.
When you open new shell/terminal window on macOS show cowsay with a fortune in rainbow colors.

Fortune with random Cowsay character and lolcat

  • On macOS using Homebrew run the following to install the packages

    brew install cowsay fortune lolcat

  • Next add the following to ~/.bash_profile

# If brew installed fortune, cowsay, and lolcat
# Upon opening a new shell show a cowsay character with a random forutune in rainbow colors
if [ -x /usr/local/Cellar/cowsay ] && [ -x /usr/local/Cellar/fortune ] && [ -x /usr/local/Cellar/fortune ]; then
    # Standard cowsay character (medium 5 lines)
    #fortune | cowsay | lolcat

    # Calf cowsay character (small 4 lines)
    fortune | cowsay -f small.cow | lolcat

    # Ghostbusters cowsay character (large over 10 lines)
    #fortune | cowsay -f ghostbusters.cow | lolcat

    # Satanic Goat cowsay character (medium 7 lines)
    #fortune | cowsay -f satanic.cow | lolcat

    # Moose cowsay character (medium 7 lines)
    #fortune | cowsay -f moose.cow | lolcat

    # Dinosaur cowsay character (large over 10 lines)
    #fortune | cowsay -f stegosaurus.cow | lolcat

    # Turtle cowsay character (large over 10 lines)
    #fortune | cowsay -f turtle.cow | lolcat

    # Linux Tux cowsay character (medium 9 lines)
    #fortune | cowsay -f tux.cow | lolcat

    # TODO: This isn't random and seems to always use the first character in the list
    # Random cowsay character
    #fortune | cowsay -f `ls -1 /usr/local/Cellar/cowsay/3.04/share/cows/*.cow | sort | head -1` -n | lolcat
fi
  • Source the updated source ~/.bash_profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment