Fortune and Cowsay for OS X / Yosemite

This guide works if you are using bash shell.

To see if you are using bash type the following in your Apple Terminal
env | grep SHELL
The output on the terminal should be
SHELL=/bin/bash


What is Fortune?
fortune(6)               - print a random, hopefully interesting, adage


What is Cowsay?
cowsay                   - print a ASCII cow in terminal to say what you want

What is Fortune and Cowsay combined together?
$ fortune | cowsay
 ______________________________________ 
/ Some scholars are like donkeys, they \
| merely carry a lot of books.         |
|                                      |
\ -- Folk saying                       /
 -------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

To make this work in OS X / Yosemite, we need to install Brew.

What is Brew?
brew(1)                  - The missing package manager for OS X

Installing Brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Installing Fortune and Cowsay
brew install fortune -y && brew install cowsay -y

Testing Fortune and Cowsay
fortune | cowsay
 ______________________________________ 
/ An apple every eight hours will keep \
\ three doctors away.                  /
 -------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Showing Fortune and Cowsay in every new terminal session
vi ~/.bash_profile

Adding "fortune | cowsay" to "~/.bash_profile"
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
fortune | cowsay

Type :wq to save the file.

Enjoy!



UPDATE!

You can use a similar program called cowthink.
Cowthink does the same as Cowsay, but in a different manner.
When you install Cowsay, Cowthink will come along with it.

See the difference?

Cowsay
fortune | cowsay
 _______________________________________ 
/ Backward conditioning:                \
|                                       |
| Putting saliva in a dog's mouth in an |
\ attempt to make a bell ring.          /
 --------------------------------------- 
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Cowthink
fortune | cowthink
 _____________________________________ 
( Excuse me, but didn't I tell you    )
( there's NO HOPE for the survival of )
( OFFSET PRINTING?                    )
 ------------------------------------- 
        o   ^__^
         o  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||


No comments:

Post a Comment