What's a smart way to count the number of days since X?
echo $(( (`date +%s` - `date +%s -d '2014/11/17'`) / 86400 )) days ago
Well, on the face of it:
$ date --date="-239 days"
Mon Nov 17 15:25:40 CET 2014
In a script (not very efficient, but... maybe it handles leap seconds? ;) )
i=0
result=""
while [ "$result" != "20141117" ]
do
i=$((i+1))
result=$(date --date="-$i days" +%Y%m%d)
done
echo "$i" days have passed since "$result"