Oct 3, 2018

[HDGEM] How to loop through date in bash

# slightly malformed input data  input_start=2017-1-1  input_end=2017-2-23    # After this, startdate and enddate will be valid ISO 8601 dates,  # or the script will have aborted when it encountered unparseable data  # such as input_end=abcd  startdate=$(date -I -d "$input_start") || exit -1  enddate=$(date -I -d "$input_end")     || exit -1    d="$startdate"  while [ "$d" != "$enddate" ]; do     echo $d    d=$(date -I -d "$d + 1 day")  done

for i in 2017-01-{01..31} 
for i in 2017-02-{01..28} 2017-{04,06,09,11}-{01..30}
   -I[TIMESPEC], --iso-8601[=TIMESPEC]                output date/time in ISO 8601 format.  TIMESPEC='date' for date only (the default), 'hours', 'minutes', 'seconds', or 'ns' for date and time                to the indicated precision.    

Posted By Blogger to HDGEM at 5/04/2017 08:57:00 AM

QuickBooks Self-Employed

Bigger tax refunds. Better organization. Manage your deductions with QuickBooks Self-Employed .