Created
September 19, 2016 08:42
-
-
Save DrSpeedy/a09a6fdd7ed65cb8bad9e962d71d262b to your computer and use it in GitHub Desktop.
Get weather from the command line
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
#!/bin/zsh | |
# Simple function to get weather from command line via curl | |
# To use either add to zshrc/bashrc, or run the command `source weather.zsh` | |
export LOC="kalamazoo" | |
# If no location is provided, weather for $LOC will be returned | |
function wthr() { | |
if [ -z "$1" ]; then | |
echo "$(curl -silent wttr.in/$LOC)" | |
else | |
echo "$(curl -silent wttr.in/$1)" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment