Skip to content

Instantly share code, notes, and snippets.

@devthiago
Last active February 28, 2016 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save devthiago/80993f8bfec92cbdf741 to your computer and use it in GitHub Desktop.
Save devthiago/80993f8bfec92cbdf741 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