Created
May 5, 2020 17:41
-
-
Save apathor/e97a80aa32a3e06a98a34cafdf779bb5 to your computer and use it in GitHub Desktop.
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 | |
uniclock() { | |
local clocks=(π π§ π π π π π π π π π π | |
π π‘ π π’ π π£ π π€ π π₯ π π¦) | |
local hour=0 min=0 now=0 num=0 | |
now="${1:-$(printf "%(%s)T\n" "-1")}" | |
read -r hour min < <(printf "%(%l %M)T\n" "$now") | |
min="${min#0}" | |
num=$(( (hour * 2) + (min >= 30) )) | |
printf "%s\n" "${clocks[$num]}" | |
} | |
if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then uniclock "$@"; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment