Last active
February 28, 2016 00:40
-
-
Save devthiago/80993f8bfec92cbdf741 to your computer and use it in GitHub Desktop.
Cool shell functions
This file contains hidden or 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
# 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