Monday, March 1, 2010

My .bashrc File Part 1 - Useful Information

I thought it would fun to have a short series regarding my .bashrc file. Feel free to share any cool aspects or insights from your .bashrc file during this series. A short disclaimer for this series, regarding most of what I will be sharing with you is NOT original content. I've copied most aspects of my .bashrc from others who have been so kind to share their cool ideas. Now, lets begin.

I want to focus the first apart of this series on having bash display useful information in an easily accessible and concise way. For example, the first thing I do each morning is run my "update" script which displays the time, my schedule for the day and the weather, which looks something like this:

Hello jared, How are you today?

Current Date and Time:

Fri Feb 26 09:00:40 MST 2010

Your Schedule:
Mon Feb 22 12:00am Zone 4
Fri Feb 26 12:00am Safety Kids Fair

6:30am Scriptures
11:00am Preschool time
Sat Feb 27 9:30am Food Co-op Pick up

Current Weather Conditons:

Current conditions at UT (KSLC)
Last updated Feb 26, 2010 - 10:53 AM EST / 2010.02.26 1553 UTC
Wind: from the SSE (160 degrees) at 13 MPH (11 KT)
Sky conditions: mostly cloudy
Temperature: 35.1 F (1.7 C)
Relative Humidity: 69%
City Forecast for Salt Lake City, UT

Here is the script I use in my .bashrc file.

function update() # Current date, time, weather and calendar
echo -e "\nHello $USER, How are you today?"
echo -e "\nCurrent Date and Time: $NC " ; date
echo -e "\nYour Schedule: $NC " ; gcalcli agenda head
echo -e "\nCurrent Weather Conditons: $NC " ; weather head -n 7
echo ""

Let me run through this function. As you can see it's all just echo commands spewing out the information I desire. I begin by having bash say "Hello" to me. Just because it's a shell doesn't mean it can't be polite. Next it displays the current date and time which is followed by my schedule for the day. My schedule is produced by a cool little app called gcalcli which was a Google summer of code project that displays your google calendar on the command line. I blogged about this app previously here. I then finish things up with the weather using the weather-utils application. I have the weather command set up as an alias (which I'll cover in another segment) to display my local weather.

As mentioned previously, this is the first command I type into the terminal when I first wake up, which gives me a quick and concise outlook for the day.

Well, I hope this was interesting to some of you. My next installment will cover displaying useful system information. So until then... enjoy!


Insanum said...

Glad you like gcalcli. Where did you hear that gcalcli was born from GSOC? Not the case... I wrote gcalcli when I was bored one weekend. :-)

Jared said...

I guess I jumped to that conclusion because your project resides on Thanks for the correction and great app. Are there any plans to add deleting and editing events? Thanks.