jueves, 14 de mayo de 2015

How to Make a Script to Get an Enlightened Cow Teach You Buddhist Sayings

I've been working too much lately, as anyone may guess by reading the title of this post  :P

When one works nonstop, it is necessary to find inner peace.  That will help getting the work done, too.

Thus, I came up with a crazy idea.  What if I could get the funny cow living in the terminal come out to my desktop and teach me something whenever I activated it?

Most seasoned Linux users are familiar with the cowsay and fortune commands.  The former displays a funny ASCII cow saying whatever you type for it to say.  The latter will randomly display a fortune, saying, or funny quote (depending on how you configure it.)

Also, Linux users who know about the terminal know very well how to pipeline commands, how to manage permissions, and how to make scripts.

Well, my knowledge about that is almost null...

Still, I managed to find a way to put all that knowledge together to make something fun (and useful for these hectic times).  The result?  A funny cow that pops into my desktop to recite me a Buddhist saying

Instead of cowsay, I installed xcowsay because the latter, when activated, will make a drawing of a cow literally appear on your desktop.



After that, I downloaded and installed display-dhammapada, which randomly displays a Buddhist saying on your terminal.

I thought I could pipeline the two commands to have an enlightened cow!  The command to type in the terminal would be:

display-dhammapada | xcowsay

Then it hit me.  Could I make a simple script to activate the cow with a mouseclick instead of typing the command?

I opened a text editor and typed this:

#!/bin/bash
clear
display-dhammapada | xcowsay

I saved the script as "cow", but  it didn't run until I changed the permissions (right click on the file, properties, permissions, and setting "owner and group" for the field "execute.")


That's how I got an enlightened cow to rescue me from going crazy by teaching me Buddhist wisdom!

Perhaps it's already too late...

6 comentarios:

  1. That is one badly needed cow! Congratulations!

    ResponderEliminar
    Respuestas
    1. I also managed to make an icon to launch the cow from the panel on XFCE and KDE. I haven't found a way to do that on LXDE, though.

      Eliminar
  2. That is one badly needed cow! Congratulations!

    ResponderEliminar
    Respuestas
    1. Number one is easily forgotten and number two is twice number one; Number three disrupts the universe because it shows that there are always more than two options...

      Eliminar
  3. That is one badly needed cow! Congratulations!

    ResponderEliminar
    Respuestas
    1. When a person feels important, that person becomes a fool. The cure to foolishness comes when that person realizes wisdom can come from a humble cow.

      Eliminar