728x90

날짜를 증가시키면서 반복하는 스크립트

#!/bin/bash
 
# 시작 날짜 설정
#current_date=$(date +%Y%m%d)
current_date="20240131"
echo "현재 날짜: $current_date"
 
# 반복 횟수 설정
num_days=55
 
# 날짜 증가 반복
for (( i=0; i<$num_days; i++ )); do
    # 현재 날짜 출력
    echo "현재 날짜: $current_date"
 
    # 다음 날짜 계산
    next_date=$(date -"$current_date + 1 days" +%Y%m%d)
    echo "다음 날짜: $next_date"
 
    # 그다음 날짜 계산
    next_next_date=$(date -"$current_date + 2 days" +%Y%m%d)
    echo "그다음 날짜: $next_next_date"
 
    unzip ${next_date}_dailynoticedata.zip
    mv AlterD.JUSUBM.${next_next_date}.TI_SPBD_BULD.TXT ${next_next_date}_BULD.cvs
 
    # 다음 반복을 위해 현재 날짜 업데이트
    current_date=$next_date
done
 
rm -*.TXT
rm -*.zip

 

 

'리눅스' 카테고리의 다른 글

CentOS 7 PHP 7.4 MariaDB 10.5 설치  (0) 2022.05.14
CentOS 5.8 APM 설치 과정  (0) 2022.05.14
VMWare Network 설정  (0) 2022.04.23
CentOS 7 Jenkins 설치  (0) 2022.03.25
Apache log Full  (0) 2022.02.22
블로그 이미지

Link2Me

,