Cowsay as much as possible


CowsayIfPossible()
{
  if [ -z "${1}" ]; then
    CowsayIfPossible "Supply some text!";
    return;
  fi
  if which cowsay >> /dev/null; then
    cowsay "${1}"
    echo =======================================
  else
    echo "${1}"
  fi
}

Cowsay is win.  EEEPPIIIICCC  WIIIIN.

This BASH script snippet allows the unashamed use of cowsay within bash scripts without fear that it isn’t installed.  World peace?  That’d be nice, but for now cowsay moooooo!

sudo aptitude install cowsay

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>