Skip to content

Instantly share code, notes, and snippets.

@maxpatternman
Last active November 10, 2021 12:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxpatternman/45e79e83f50513306255a7caf691727b to your computer and use it in GitHub Desktop.
Save maxpatternman/45e79e83f50513306255a7caf691727b to your computer and use it in GitHub Desktop.
Weather information with curl and wttr.io
#!/usr/bin/env bash
# usage: wttr [location], e.g. wttr Berlin, wttr New\ York
# Standard location if no parameters were passed
location=''
language=''
# Expand terminal display
printf "\e[8;41;125t"
if [ -z "$language" ]; then
language=${LANG%_*}
fi
curl \
-H "Accept-Language: ${language}" \
wttr.in/"${1:-${location}}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment