From Rude Capybara, 2 Weeks ago, written in Plain Text.
  1. #! /bin/bash
  2.  
  3. ##values for validation
  4. VALIDDAY=*1-31
  5. VALIDMONTH=*1-12
  6. VALIDYEAR=*-14
  7.  
  8. ##store date
  9. bash -e date +%d | cat > current-day ;
  10. bash -e date +%m | cat > current-month ;
  11. bash -e date +%y | cat > current-year ;
  12.  
  13. ##begin
  14. echo -e "born day\n"
  15.         read DAY
  16.            if $DAY = $VALIDDAY ; then
  17.                 grep --regexp=** current-day ;
  18.                    read TODAY
  19.                         RESULTDAY=$TODAY-$DAY
  20.                           cat $RESULTDAY > result-day
  21.            else
  22.                 echo -e "Please enter a valid day!"
  23.            fi
  24.  
  25. echo -e "born month\n"
  26.         read MONTH
  27.            if $MONTH = $VALIDMONTH ; then
  28.                 grep --regexp=** current-month ;
  29.                    read TOMONTH
  30.                         RESULTMONTH=$TOMONTH-$MONTH
  31.                           cat $RESULTMONTH > result-month
  32.            else
  33.                 echo -e "Please enter a valid month!"
  34.            fi
  35.  
  36. echo -e "born year\n"
  37.         read YEAR
  38.            if $YEAR = $VALIDYEAR ; then
  39.                 grep --regexp=** current-year ;
  40.                    read TOYEAR
  41.                         RESULTYEAR=$TOYEAR-$YEAR
  42.                           cat $RESULTYEAR > result-year
  43.            else
  44.                 echo -e "Please enter a valid year!"
  45.            fi
  46.  
  47. ##grep --regexp=* result-day > cat > final
  48. ##grep --regexp=* result-month > cat >> final
  49. ##grep --regexp=* result-year > cat >> final
  50.  
  51. grep --regexp=* result-day > read FINALDAY
  52. grep --regexp=* result-month > read FINALMONTH
  53. grep --regexp=* result-YEAR > read FINALYEAR
  54.  
  55.  
  56. echo -e "You have been alive" $FINALDAY "days," $FINALMONTH "months, and" $FINALYEAR
captcha