Trying to compare date in if satement
I have a script that creates files and at midday UTC I would like to copy it to a web server. I can't seem to get the if statement correct. I don't know the exact time that I will have an image but it will be between midday and 30 seconds past midday. I tried this but it does not copy the files ?
Code:
#!/bin/bash Any help would be appreciated. |
Get rid of the dashes and it'll work as-is.
Code:
DATE2=$(date +"%H%M%S") |
Quote:
Quote:
Code:
DATE2=$(date +"%H%M%S") |
My problem is this.
I have a script that gets an image from a camera every 30 secs or there abouts. I do not know the exact time as it changes because of the script. Quote:
So that is why I trying to get the time as I do not know how to find the file that may be created between 000000 and 000030. |
Numbers with a leading zero will be interpreted as octal, and "9" is not a valid octal digit. Include an explicit base specification:
Code:
if [[ 10#"$DATE2" -gt 10#"023200" && 10#"$DATE2" -lt 10#"023230" ]] ; then |
Quote:
That worked just fine. I am not a programmer so my code is not very sophisticated but it works most of the time. |
All times are GMT -5. The time now is 04:06 AM. |