shell中,有两个字符串,"2004.05.23" 和"2005.0..
时间:2007-04-19 来源:codfei
[root@better ~]# date -d `echo "2005.03.01"|tr '.' '-'` +%s
1109606400
[root@better ~]# date -d `echo "2004.05.23"|tr '.' '-'` +%s
1085241600
[root@better ~]# [[ "2006.01.23" > "2005.03.01" ]] && echo dayu || echo budayu
dayu
[root@better ~]# [[ "2004.01.23" > "2005.03.01" ]] && echo dayu || echo budayu
budayu
[root@better ~]# [ "2006.01.23" \> "2005.03.01" ] && echo dayu || echo budayu
dayu
[root@better ~]# [ "2004.01.23" \> "2005.03.01" ] && echo dayu || echo budayu
budayu
1109606400
[root@better ~]# date -d `echo "2004.05.23"|tr '.' '-'` +%s
1085241600
[root@better ~]# [[ "2006.01.23" > "2005.03.01" ]] && echo dayu || echo budayu
dayu
[root@better ~]# [[ "2004.01.23" > "2005.03.01" ]] && echo dayu || echo budayu
budayu
[root@better ~]# [ "2006.01.23" \> "2005.03.01" ] && echo dayu || echo budayu
dayu
[root@better ~]# [ "2004.01.23" \> "2005.03.01" ] && echo dayu || echo budayu
budayu
相关阅读 更多 +