Skip to content

Instantly share code, notes, and snippets.

@lepht
Created July 9, 2012 01:24
Show Gist options
  • Save lepht/3073718 to your computer and use it in GitHub Desktop.
Save lepht/3073718 to your computer and use it in GitHub Desktop.
#!/bin/bash
TZ='America/New_York'
URL='http://weather.yahooapis.com/forecastrss?w='
l=2432214 # maui
export $(curl -s "$URL$l" | perl -ne'while(/(sunrise|sunset)="(.*?)"/g) { print "$1=$2\n" }')
if [ "$1" = "sunrise" ] ; then
TZ=$TZ date --date="TZ=\"HST\" $sunrise am"
elif [ "$1" = "sunset" ] ; then
TZ=$TZ date --date="TZ=\"HST\" $sunrise pm"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment