[Uaflug] I wrote a script

Paul Swanson themadcellist at gmail.com
Sat May 12 14:28:24 AKDT 2007


Hooray!

I made a little bash script to tell me the difference between two days
in Linux. It takes the one or two dates, converts them into seconds,
subtracts them, divides by the number of seconds in a day, then prints
it out.

Why? Because I need to figure this out regularly, and I'm too lazy to
count. And because I'm done with finals and bored.

wget http://modzer0.cs.uaf.edu/~dev2c/daysapart.sh
chmod +x daysapart.sh

./daysapart.sh

Usage: ./daysapart.sh date1 [date2]
Standard date format (mm/dd/yy)
Omitting second date defaults to present date
You may omit years

./daysapart.sh 3/6 5/12 # How many days have I been 21?
66 days apart

./daysapart.sh 3/6/86 # How many days old am I?
7736 days apart

-Paul


More information about the uaflug mailing list