Last active
December 11, 2015 23:49
-
-
Save welbornprod/4679400 to your computer and use it in GitHub Desktop.
display current weather in your BASH terminal. Uses zip-code to determine current area. Might need to install 'lynx' console browser. ... sudo apt-get install lynx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BASH function | |
function weather() { | |
if [ "${1}" = "" ] ; then | |
# echo "Usage: weather 90210" | |
lynx -dump -nonumbers -width=160 "http://weather.unisys.com/forecast.php?Name=90210" | grep -A13 'Latest Observation' | |
else | |
lynx -dump -nonumbers -width=160 "http://weather.unisys.com/forecast.php?Name=${1}" | grep -A13 'Latest Observation' | |
fi | |
} | |
# BASH single-line command: | |
lynx -dump -nonumbers -width=160 "http://weather.unisys.com/forecast.php?Name=[YOUR_ZIP_CODE_HERE]" | grep -A13 'Latest Observation' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BASH function | |
function weatherweek() | |
{ | |
# show weather for the week per zipcode | |
if [ "${1}" = "" ] ; then | |
# echo "Usage: weatherweek [Your ZipCode]" | |
lynx -dump -nonumbers -width=160 "http://weather.unisys.com/forecast.php?Name=90210" | grep -A30 'Forecast Summary' | |
else | |
lynx -dump -nonumbers -width=160 "http://weather.unisys.com/forecast.php?Name=${1}" | grep -A30 'Forecast Summary' | |
fi | |
} | |
# BASH single-line command | |
lynx -dump -nonumbers -width=160 "http://weather.unisys.com/forecast.php?Name=[YOUR_ZIPCODE_HERE]" | grep -A30 'Forecast Summary' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is part of a series of old-school BASH commands that I picked up a long time ago. The problem was none of those commands worked. The server they connected to had been moved, or changed the format of their pages. So I re-wrote a couple of my favorites, and saved them here for anyone to use. As of today, all of these commands work.