It came with every Linux distro (I think). I mean date(1) in Linux (which is from FSF) is different from date(1) in *BSD. And I think $(( ... )) will do the same thing with expr? I'm using bash anyway.

dennis2 (Dennis)
Actually my script has problems, it overflows much earlier than it should be. Here's an updated one:


s1=`date -d $1 +%s`
s2=`date -d $2 +%s`
echo "Days: " $(($day2 - $day1))

But like I said it can only calculate from 1902 - 2038. I'll try to come up one with awk (why I didn't think of that? stupid me) if I have time. But I have to deal with leap year myself I guess.

2001-7-10 -04:00

回到话题: I came across this post in chinasmile. Nobody has answered his question yet. I couldn't figure out a way to do it with shell scripts, although

回到论坛: HOME枫下论坛枫下论坛主坛工作学习IT技术讨论