Skip to content

Instantly share code, notes, and snippets.

@rands0n
Forked from devthiago/weather.sh
Created February 28, 2016 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rands0n/452719c3c1cfe2c3da8f to your computer and use it in GitHub Desktop.
Save rands0n/452719c3c1cfe2c3da8f to your computer and use it in GitHub Desktop.
Cool shell functions
# WEATHER INFO ------------------------------------------------------------
# Usage:
# $ weather [CITY_NAME]
# Examples:
# $ weather #returns current local weather
# $ weather "Porto Alegre" #returns Porto Alegre weather
function weather {
if [ -z "$1" ]; then
curl http://wttr.in/;
else
city=$( printf "%s\n" "$1" | sed 's/ /%20/g' );
curl http://wttr.in/$city;
fi
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment