Automating bash task

function sleep_until {
seconds=$(( $(date -d “$” +%s) – $(date +%s) ))
echo “Sleeping for $seconds seconds”
sleep $seconds
}


Usage:
sleep_until 8:24
Sleeping for 35 seconds
sleep_until ’23:00′
Sleeping for 52489 seconds
sleep_until ‘tomorrow 1:00’
Sleeping for 59682 seconds