Skip to content

Instantly share code, notes, and snippets.

@exapsy
Last active May 9, 2020 10:40
Show Gist options
  • Save exapsy/07d575bff0bd63d36ed6f8cf472ea2c0 to your computer and use it in GitHub Desktop.
Save exapsy/07d575bff0bd63d36ed6f8cf472ea2c0 to your computer and use it in GitHub Desktop.
# Weather curl
function weather {
if [ -z "$1" ]; then
location="YOUR DEFAULT LOCATION HERE"
else
location=$1
fi
[ ! -d ~/.cache/weather ] && \
mkdir ~/.cache/weather
[ "$(stat -c %y ~/.cache/weather/$location 2>/dev/null | cut -d' ' -f1 )" != "$(date --iso-8601)" ] &&
curl -s wttr.in/$location > ~/.cache/weather/$location;
cat ~/.cache/weather/$location
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment