Skip to content

Instantly share code, notes, and snippets.

@uilian
Created October 18, 2021 13:59
Show Gist options
  • Save uilian/96d76610ad2d7cf54c15113d51c87be5 to your computer and use it in GitHub Desktop.
Save uilian/96d76610ad2d7cf54c15113d51c87be5 to your computer and use it in GitHub Desktop.
Custom cowsay script
#!/bin/bash
#
# see: http://blog.tomtung.com/2009/11/cowsay-fortune
# http://www.commandlinefu.com/commands/view/3584/remove-color-codes-special-characters-with-sed
# https://github.com/busyloop/lolcat
# https://github.com/dorentus/mruby-lolcat-bin
#
# requires `fortune`, `cowsay`,
# and ruby gem `lolcat` or its mruby version equivalent
# Randomly pick a mode of the cow
MODES=("" -b -d -g -p -s -t -w -y );
MODE=${MODES[$(($RANDOM % 9))]}
# Radomly pick a cow picture file
COWIMG=`cowsay -l | sed '1d;s/ /\n/g'| sort -R | head -1`
fortune | cowsay -f $COWIMG $MOD | lolcat
printf "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment