<< December 10, 2004 | Home | December 12, 2004 >>

How Many Days Ago Was That?

After doing my "how many days ago" calculation in my head once too many, I set out to find a way to let my computer do the work. After trying Java and C, I settled on this bash script:

[weiqi@gao] $ cat ~/bin/daysago
#!/bin/bash
#
# Usage: daysago [date]
#
bc <<<`date +%j`-`date -d $1 +%j`

[weiqi@gao] $ daysago 11/23
18

Can you name all the bash features used in this script?