Changeset 18323
- Timestamp:
- 08/31/15 01:42:26 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/DataCheck/Sourcefile.sh
r18210 r18323 481 481 ;; 482 482 # certain date 483 [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]) 484 printprocesslog "DEBUG getdates case certain date: "$1 485 dates=( $1 ) 483 [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]|[0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]-[0-9][0-9][0-9]) 484 d=`echo $1 | grep -o [0-9][0-9][0-9][0-9]/[0-9][0-9]/[0-9][0-9]` 485 range=`echo $1 | grep -o '[0-9][0-9][0-9]$'` 486 range=`echo $range | sed -e 's/^0//' -e 's/^0//'` 487 printprocesslog "DEBUG getdates - certain date "$d"." 488 dates=( $d ) 489 if [ "$range" != "" ] 490 then 491 printprocesslog "DEBUG getdates - add the last "$range" days." 492 yy=`echo $d | cut -c 1-4` 493 mm=`echo $d | cut -c 6-7` 494 dd=`echo $d | cut -c 9-10` 495 for (( numdates=1 ; numdates <= $range ; numdates++ )) 496 do 497 numhours=`echo " 12 + ( $numdates - 1 ) * 24 " | bc -l` 498 dates=( ${dates[@]} `date +%Y/%m/%d --date=$yy/$mm/$dd"-"$numhours"hour"` ) 499 done 500 fi 486 501 ;; 487 # certain number of dates (between 0 and 99 488 [ 0-9][0-9]|[0-9]|[0-9][0-9][0-9])502 # certain number of dates (between 0 and 9999) 503 [1-9][0-9][0-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9]|[1-9]) 489 504 # get last n nights 505 printprocesslog "DEBUG getdates - get the last "$1" days." 490 506 for (( numdates=1 ; numdates <= $1 ; numdates++ )) 491 507 do … … 500 516 if [ $hour -le $2 ] || [ $hour -ge $3 ] 501 517 then 518 printprocesslog "DEBUG getdates - get the current night." 502 519 dates=( `date +%Y/%m/%d --date="-12hour"` ) 503 520 fi … … 505 522 ;; 506 523 *) # nothing valid given 507 echo "Please give valid option s for the function 'getdates()'"524 echo "Please give valid option (YYYY/MM/DD[-RRR] or 1-9999)" 508 525 finish 509 526 ;;
Note:
See TracChangeset
for help on using the changeset viewer.