1
好的,我现在的情况是我想知道在2013年5月15日之前的特定日期,究竟有多少天。剩下的日期并不重要,计算出达到那一天之前的剩余天数。找出剩余时间在Linux中的时间
我觉得做这样的(伪代码):
y=$end_year-$cur_year
if [ y -ge 1 ]; then
days=$y*365
else
continue
fi
if [ $end_month -gt $cur_month ]; then
m=$end_month-$cur_month
else
contine
fi
if [ $end_day -gt $cur_day ]; then
d=$end_day-$cur_day
else
continue
fi
result=$days+$m+$d
现在我不知道是否有这样做的更简单的方法,因为我很新的Linux和shell脚本,所以如果有一个更好的方法来做到这一点,请帮助我。