[Tutorial] ASCII Weather

Guides and tutorials for various stuff. Posted by DietPi users.
Post Reply
User avatar
Phillski
Posts: 8
Joined: Fri Feb 02, 2018 9:52 am

[Tutorial] ASCII Weather

Post by Phillski » Fri Feb 02, 2018 10:26 am

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)

Code: Select all

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).

Code: Select all

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
Weather2.png (10.3 KiB) Viewed 823 times
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:
Weather5.png
Last edited by Phillski on Sun Feb 04, 2018 4:12 am, edited 1 time in total.

User avatar
WarHawk
Posts: 290
Joined: Thu Jul 20, 2017 7:55 am

Re: [Tutorial] ASCII Weather

Post by WarHawk » Fri Feb 02, 2018 2:44 pm

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

Code: Select all

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

User avatar
Phillski
Posts: 8
Joined: Fri Feb 02, 2018 9:52 am

Re: [Tutorial] ASCII Weather

Post by Phillski » Mon Feb 05, 2018 10:31 am

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

The world needs more fun ASCII stuff.

Post Reply