[Tutorial] ASCII Weather

I’m sure at some point we have all wanted to know what the weather forecast is but did not want to leave the safety of our SSH session. Well, now you can with a simple command.

Just enter this into your command line to install.

This version is now obsolete (still works just fine but is only supports 2 column output)

echo -e "\nfunction weather() { curl wttr.in/\$@?2n; }" >> ~/.bashrc
source ~/.bashrc

New Version that will return an expanded weather report if your session is wide enough (and incorporates WarHawks suggestion).

echo -e "\nfunction weather()\n{\nif [ \$COLUMNS -lt 125 ]\nthen\n  curl wttr.in/\$@?2n\nelse\n  curl wttr.in/\$@\nfi\n}" >> ~/.bashrc && source ~/.bashrc

To use just type ‘weather’ at the prompt and you will get the weather forecast for your current IP based location:
Weather1.png
Scrolling up gets you this:
Weather2.png
Should you wish to get the weather report for a different location … well, you can do that too!
Here’s the output for ‘weather NewYork’:
Weather3.png
Weather4.png
If you’re running a session that is nice and wide it will (now) return an expanded weather report.
In this example columns=132 and rows=43:

3 Likes

Oh that is SO COOL!!!

Honestly…developers…you should make this part of the build!

Very neat!!!

I go thru my .bashrc and make the alias’s a bit different
alias ll=‘ls -lah’

this way to get a full directory listing…i just type ll also uncommented the color stuff so my command prompts and stuff are color

Very awesome!!! Thanks for this!

oh you can make that command all one line too

echo -e "\nfunction weather() { curl wttr.in/\$@?2n; }" >> ~/.bashrc && source ~/.bashrc

Glad you like it, just for fun you can even check the weather on the moon :slight_smile:

The world needs more fun ASCII stuff.

Hi,

Where can I change default location please ?

There is no default location as such as it it worked out from your IP address, you can specify the location by typing ‘weather CityName’ (e.g. ‘weather Moscow’)

That looks good! :smiley: Its a bit windy on the moon.

1 Like