D1=$(date -d now +%s) ...... D2=$(date -d now +%s) timex=$(($D2-$D1)) #注意:是双括号 参考文章:http://blog.csdn.net/zjwoody/article/details/7875291