作者 Anonymous [bash] 2012-12-19 15:20 (点击下载)

  1. function date_gen(){
  2. [[ $1 ]] || exit 1;
  3. [[ $2 ]] || exit 2;
  4. (( $(date -d "$1" +'%s') < $(date -d "$2" +'%s') )) || exit 3;
  5. fmt='%Y_%m_%d';
  6. ct=0;
  7. target_day=$(date -d"$2" +"$fmt");
  8. while curr_day=$(date -d"$1 +$ct day" +"$fmt")
  9. [ "$curr_day" != "$target_day" ]
  10. do
  11. echo $curr_day;
  12. ct=$((ct + 1));
  13. done
  14. }
  15.  
  16. days=$(date_gen "2012/12/12" "2012/12/19");

提交下面的校正或者修改. (点击这里开始一个新的帖子)
姓名: 在 cookie 中记住我的名字

屏幕抓图:(jpeg 或 png)