Created
June 7, 2012 20:21
-
-
Save lukas-buergi/2891323 to your computer and use it in GitHub Desktop.
Display your age in seconds
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/sh | |
if test -r .dateofbirth; then | |
echo "You are $( echo "($(date '+%s')+sqrt($(cat .dateofbirth)^2)) - ($(cat .dateofbirth))+sqrt($(cat .dateofbirth)^2)" | bc) seconds old." | |
else | |
echo "Enter your date of birth before I can tell you how old you are." | |
echo "One of the accepted formats is \"YYYY-MM-DD HH:MM\"." | |
echo -n "Your date of birth is " | |
read dob | |
date --date="$dob" '+%s' > .dateofbirth | |
$0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment