Skip to content

Instantly share code, notes, and snippets.

@sbilstein
Last active July 19, 2018 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbilstein/25fd5b846ae30c006d6e45b58acb1c9c to your computer and use it in GitHub Desktop.
Save sbilstein/25fd5b846ae30c006d6e45b58acb1c9c to your computer and use it in GitHub Desktop.
Get an emoji for the time of day!
#!/bin/bash
function get_time
{
local hour="`date +%H`"
local emoji="a"
if [ $hour -lt 10 -a $hour -gt 6 ]; then
emoji="🌅"
elif [ $hour -lt 15 ]; then
emoji="☀️"
elif [ $hour -lt 20 ]; then
emoji="🌇"
else
emoji="🌓"
fi
current_time="`date +%H:%M:%S`";
echo "$current_time $emoji";
}
get_time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment