#!/bin/bash AZIMUTH="$(heliocron poll |grep Azimuth |grep -o [[:digit:]]*|head -n 1)" case $(sunwait poll $LATLONG) in DAY) if [[ $AZIMUTH -gt 100 ]] then sunsetter -d else sunsetter -b fi ;; NIGHT) if [[ $AZIMUTH -ge 270 ]] && [[ $AZIMUTH -lt 280 ]]; then #sunset - 8 ish sunsetter -e elif [[ $AZIMUTH -ge 280 ]] && [[ $AZIMUTH -lt 340 ]]; then # 8ish to Midnightish sunsetter -n elif [[ $AZIMUTH -ge 340 ]] || [[ $AZIMUTH -lt 50 ]]; then # 12 - 3 sunsetter -l elif [[ $AZIMUTH -ge 50 ]]; then sunsetter -b #after 3 else echo PROBLEM fi ;; esac