Skip to content

Instantly share code, notes, and snippets.

@sbilstein sbilstein/getTimeEmoji.sh
Last active Jul 19, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.