Skip to content

Instantly share code, notes, and snippets.

@apathor
Created May 5, 2020 17:41
Show Gist options
  • Save apathor/e97a80aa32a3e06a98a34cafdf779bb5 to your computer and use it in GitHub Desktop.
Save apathor/e97a80aa32a3e06a98a34cafdf779bb5 to your computer and use it in GitHub Desktop.
#!/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