Last active
October 17, 2016 19:36
-
-
Save dhhdev/cb06fe6f85dab8cee1bf49fcd2e22894 to your computer and use it in GitHub Desktop.
BSD date version of how many days until Christmas :-)
This file contains 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/sh | |
# Today, as day-of-year (1-366) | |
TODAY=$(date -j +"%j") | |
# Christmas day, in d-B-y format converted to days | |
CHRISTMAS=$(date -jf "%d-%B-%y" "25-DEC-16" +"%j") | |
echo "There are $(($CHRISTMAS - $TODAY)) days until Christmas." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment