#!/bin/bash
at now +1 minutes -f ./test.sh
logFile="/home/.../testLog.txt"
time1="114000"
time2="153000"
currentTime=`date +"%H%M%S"`
echo "" >> "$logFile"
date >> "$logFile"
echo "$currentTime" >> "$logFile"
echo "" >> "$logFile"
if [[ "$currentTime" < "$time1" || "$currentTime" > "$time2" ]]
then
echo "case1" >> "$logFile"
else
echo "case2" >> "$logFile"
fi
This script is saved in a file called test.sh
. When I execute it at for example 5 pm it writes case1
into my log file. But for each subsequent at
call (which takes place every minute) the script writes case2
into my log file. Can you explain why?
Aucun commentaire:
Enregistrer un commentaire