Saturday, October 5, 2013

What does the cowsay?

Rather than wine-ing about how long it's been since my last post, I thought I would move directly into pop culture today. Many of you may have heard Ylvis's song "The Fox," where a single question is posed and repeated over and over again: "What does the fox say?" This is, of course, a silly question. The sound of the fox has been recorded before, and sounds nothing like Ylvis's interpretation of what they might sound like. That being said, today I would like to introduce an old linux command: cowsay. It's function is somewhat self-explanatory: it creates an ASCII cow that says whatever you want it to say.

What is the purpose in this command? There is none, and that's okay. If there were a purpose to every linux command, video games would never have been invented. Because the ASCII image is somewhat dependent on the text used, I will be posting the outputs directly from my terminal. Here is an example output:

$cowsay "Hey, at least I'm not a pig"



If you are anything like me, you might be thinking, "Okay. This command is cool, but what else does it do?" Short answer: a bunch more. 

  • -b enacts borg mode
  • -t yields a tired cow
  • -d provides a dead cow
  • -s surprises the cow (sometimes referred to as a "stoned cow")
  • -g makes the cow greedy
  • -p causes paranoia
  • -w causes the cow to be wide awake
  • -y gives the cow youthful, kiddy eyes
  • -l lists all the other cow files you can pull from (likely out of /usr/share/cows)
  • -f chooses an alternative cowfile to use from the "l" flag's list

What types of cows are available? Quite a few. A full list can be found at the end of this post. Before that, though, I would like to take a minute to go over a new "cow" I have created: the fox. Just how did I do this? Well, I created an ASCII fox image that looked something like this:



I then navigated to /usr/share/cows and created the file "fox.cow". Now, in order to format the file appropriately and allow the fox to have changeable eyes, the image in the file ended up resembling a headless chicken, rather than a fox. After using the command, though, it ended up working pretty well. Here is the text:

##
## A fox, Leios
##
$eyes = "oo" unless ($eyes);
$the_cow = <<EOC;
 $thoughts              /\\
  $thoughts             )~)
    /\\/\\       ( (
   ( $eyes )_-------_)
    \\__/         )
     \\/ /|/---\\|\\
      .. ..  ..  ..
EOC


If you simply copy and paste that into a new "fox.cow" file, located in your $COWPATH (likely /usr/share/cow), you should be able to see the following:

$cowsay -f fox "I really sound like a dog"



And there you have it folks! What does the fox say? Anything your little penguin heart desires. The following is a list of all the "cows" available for you after installing from the Arch repositories:

[WARNING] Most of these images were made by linux users. [/WARNING]

  • bong
  • bud-frogs 
  • bunny 
  • cheese 
  • cower 
  • daemon 
  • default 
  • dragon
  • dragon-and-cow 
  • elephant 
  • elephant-in-snake
  • eyes 
  • flaming-sheep 
  • ghostbusters 
  • head-in 
  • hellokitty 
  • kiss 
  • kitty 
  • koala 
  • kosh 
  • luke-koala 
  • meow 
  • milk
  • moofasa 
  • moose 
  • mutilated 
  • ren 
  • satanic 
  • sheep 
  • skeleton 
  • small 
  • sodomized
  • stegosaurus 
  • stimpy 
  • supermilker 
  • surgery 
  • telebears 
  • three-eyes 
  • turkey turtle
  • tux 
  • udder 
  • vader
  • vader-koala 
  • www

                                                                                      If there are any physicists still reading: