Last active
December 28, 2015 18:19
-
-
Save jacyzon/7542167 to your computer and use it in GitHub Desktop.
Show star sign by entering birth date.
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 | |
# Show user's star sign by entering birth date. | |
# 2013/11/19 Jason YiZhang Chen | |
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin | |
export PATH | |
STAR_SIGN=(Capricorn Aquarius Pisces Aries Taurus Gemini Cancer Leo Virgo Libra Scorpio Sagittarius Capricorn) | |
STAR_SIGN_DATE=(001 019 020 049 050 079 080 109 110 140 141 172 173 203 204 234 235 265 266 296 297 326 327 355 356 365) | |
read -p "Enter your birth date (ex: 01/20):" userDate | |
userDate=$(date -d $userDate +%j) | |
for (( i = 0; i <= ${#STAR_SIGN_DATE[*]} - 1; i = $i + 2 )); do | |
if [[ 10#${STAR_SIGN_DATE[ $i ]} -le 10#$userDate && 10#$userDate -le 10#${STAR_SIGN_DATE[ $i+1 ]} ]]; then | |
echo "Your star sign is" ${STAR_SIGN[ $i/2 ]} | |
exit 0; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment