Last active
May 23, 2021 21:54
-
-
Save alicraigmile/cc83201e07ddc8472765 to your computer and use it in GitHub Desktop.
Say hello to me.
This file contains hidden or 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 | |
#Source: https://gist.github.com/alicraigmile/cc83201e07ddc8472765 | |
function welcome() { | |
HOUR=$(date +%H) | |
HOUR=$(expr $HOUR + 0) #fix for leading zeros | |
NAME=$(finger $USER |head -n1 |cut -d : -f3 | sed -e 's/^ *//' | cut -d ' ' -f1) #firstname (remove last 'cut' for full name) | |
if [[ $HOUR -lt 5 ]]; then | |
echo "Go to bed, $NAME!"; | |
elif [[ $HOUR -lt 12 ]]; then | |
echo "Welcome, $NAME. Good morning."; | |
elif [[ $HOUR -lt 17 ]]; then | |
echo "Welcome, $NAME. Good afternoon."; | |
else | |
echo "Welcome, $NAME. Good evening."; | |
fi | |
} | |
welcome |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment