Skip to content

Instantly share code, notes, and snippets.

@lukas-buergi
Created June 7, 2012 20:21
Show Gist options
  • Save lukas-buergi/2891323 to your computer and use it in GitHub Desktop.
Save lukas-buergi/2891323 to your computer and use it in GitHub Desktop.
Display your age in seconds
#!/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