Skip to content

Instantly share code, notes, and snippets.

@DrSpeedy
Created September 19, 2016 08:42
Show Gist options
  • Save DrSpeedy/a09a6fdd7ed65cb8bad9e962d71d262b to your computer and use it in GitHub Desktop.
Save DrSpeedy/a09a6fdd7ed65cb8bad9e962d71d262b to your computer and use it in GitHub Desktop.
Get weather from the command line
#!/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