Created
February 4, 2021 14:53
-
-
Save raresteak/c4606ec98c7daf1a75e86335c7d8ff9d to your computer and use it in GitHub Desktop.
Returns remaining seconds, minutes, hours from present time to new day.
This file contains hidden or 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
#!/bin/bash | |
TOMORROW=$(date -d "tomorrow" +%Y%m%d) | |
NOW=$(date -d "now" +%s) | |
EOD=$(date -d "$TOMORROW" +%s) | |
echo "$(date)" | |
echo "Remaining seconds today: $(expr $EOD - $NOW)" | |
echo "Remaining minutes today: $(echo "scale=2;$(expr $EOD - $NOW)/60" | bc)" | |
echo "Remaining hours today: $(echo "scale=2;($(expr $EOD - $NOW)/60)/60" | bc)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment