#!/bin/bash

pre=$(date +"%T")

echo "pre time : $pre"

SaveIFS=$IFS
IFS=":"
declare -a Array=($pre)
IFS=$SaveIFS

echo "Array[0]=${Array[0]}"
echo "Array[1]=${Array[1]}"
items=`echo ${Array[2]} | sed 's/^0*//'`
#echo "Array[2]=${Array[2]}"

tpre=$((${Array[0]}*60*60+${Array[1]}*60+$items))

echo "Current time for second : = $tpre"

echo $tpre > dump.tsp

tget=$(cat dump.tsp)

echo $tget

tset=$(($tget+60))
echo "tset time : $tset"

while :
do
    now=$(date +"%T")
    echo "Current time : $now"
   
    SaveIFS=$IFS
    IFS=":"
    declare -a Array1=($now)
    IFS=$SaveIFS
    items=`echo ${Array1[2]} | sed 's/^0*//'`
   
    tpre1=$((${Array1[0]}*60*60+${Array1[1]}*60+$items))
    echo "Current time for second : = $tpre1"
   
    if [ $tpre1 -ge $tset ]
    then
          echo "Current time to make a file : $tpre1 pre : $tset"
          echo $tpre1 > dump.tsp
          exit 0
    fi
   
    sleep 3

done

'Script > Bash Shell' 카테고리의 다른 글

삼성 STB 패치 방법  (0) 2012.09.07
re-direction test shell script  (0) 2012.09.06
Re-direction by shell script  (0) 2012.08.26
find 파일명만 추출  (0) 2012.08.05