Last active
May 9, 2020 10:40
-
-
Save exapsy/07d575bff0bd63d36ed6f8cf472ea2c0 to your computer and use it in GitHub Desktop.
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
# 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