Shell gets the time range for the last one months, week

Source: Internet
Author: User
#!/bin/bashdate_today= ' date-d ' 1 day ago ' +%y%m%d ' #最近7天date_befor_7day = ' date-d ' 7 day ago ' +%y%m%d ' #上一个完整周 (Monday to Sunday) OFD ay= "' Date" +%u "'" "stepofday=" ' Expr $OFDAY + 6 ' "date_befor_weekday=" ' date-d '-' $STEPOFDAY ' Day ' "+%y-%m-%d" "date_befor _weekday_end= "' date-d '-' $OFDAY ' Day '" +%y-%m-%d "'" #本月date_this_month = ' Date +%y%m01 ' #上一个完整月date_befor_month = ' date- d ' 1 month ago ' +%y%m01 ' #最近三个月date_befor_3month = ' date-d ' 3 month ago ' +%y%m01 ' #上个季度 echo ' Day: $date _today "echo" Last 7 days: $da te_befor_7day-$date _today "echo" Last full week: $date _befor_weekday-$date _befor_weekday_end "echo" in this month: $date _this_month-$ Date_today "echo" Last complete month: $date _befor_month-$date _this_month "

Shell gets the time range for the last one months, week

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.