Last active
February 27, 2017 14:09
-
-
Save woodrowbarlow/9ef19ce5c5d48eddb8f08063aed1b0d9 to your computer and use it in GitHub Desktop.
Output an analog clock for the current time, using unicode.
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/bash | |
# Output an analog clock for the current time. | |
# Rounded to the nearest half-hour. | |
(( clock = $(date +"%I") + 143 )) | |
if [[ $(date +"%M") > 45 ]]; then | |
(( clock ++ )) | |
[[ $clock > 152 ]] && (( clock = 144 )) | |
elif [[ $(date +"%M") > 15 ]]; then | |
(( clock += 12 )) | |
fi | |
echo -e "\xF0\x9F\x95\x$(printf "%02x" $clock)" |
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/bash | |
# Output an analog clock for the current time. | |
# Rounded to the most recent half-hour. | |
(( clock = $(date +"%I") + 143 )) | |
if [[ $(date +"%M") > 30 ]]; then | |
(( clock += 12 )) | |
fi | |
echo -e "\xF0\x9F\x95\x$(printf "%02x" $clock)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment