[Cialug] Moon Me

Todd Walton tdwalton at gmail.com
Fri Jul 13 14:26:17 UTC 2018


@ ~> grep -A8 'Moon me' ~/.bashrc
# Moon me
get-moon-status () { curl -s wttr.in/Moon -o ~/.last-moon-status; sed -ir
's/^[[:alnum:]].*$//' ~/.last-moon-status; }
set-moon-status-date () { date '+%Y%j' > ~/.last-moon-status-date; }
declare -i MOON_STATUS_DATE=$(cat ~/.last-moon-status-date 2> /dev/null);
MOON_STATUS_DATE=${MOON_STATUS_DATE:-0}
if [[ $(date '+%Y%j') -gt $MOON_STATUS_DATE ]]; then
    get-moon-status;
    set-moon-status-date;
    cat ~/.last-moon-status;
fi;

--
Todd


More information about the Cialug mailing list