We have a script for doing backups. These backups happen on Saturday (6) and they do different types of backups on odd and even weeks. So, we have an "if" statement similar to what I posted below.
if [[ $(date +%u) -eq 6 ]] && [[ $(( $(date +%U ) %2 )) -eq 0 ]]
then do something
else do something else
The problem comes in with the "$(date +%U ) %2" section. The "date +%U" returns a two digit number representing the week in the year. For some reason in AIX 5.1, (I could not reproduce this in 4.3.3), the script errors out whenever the number starts with a "0" and ends with a "8" or a "9". So in the 8th and 9th week (08 and 09), our script bombed out. I've tryed various calculation toward this. I've found that 028 and 029 do the same thing. Other number combinations are not affected (i.g. 05, 06, 07, 027, etc). I've only seen this on 5.1 machines (I don't have any with 5.2 yet). AIX 4.3.3 machines are fine. Has anybody else seen this? or know of a fix/APAR/PTF for it?
Oh yeah, we are also on ML04.
Thanks,
Tim
if [[ $(date +%u) -eq 6 ]] && [[ $(( $(date +%U ) %2 )) -eq 0 ]]
then do something
else do something else
The problem comes in with the "$(date +%U ) %2" section. The "date +%U" returns a two digit number representing the week in the year. For some reason in AIX 5.1, (I could not reproduce this in 4.3.3), the script errors out whenever the number starts with a "0" and ends with a "8" or a "9". So in the 8th and 9th week (08 and 09), our script bombed out. I've tryed various calculation toward this. I've found that 028 and 029 do the same thing. Other number combinations are not affected (i.g. 05, 06, 07, 027, etc). I've only seen this on 5.1 machines (I don't have any with 5.2 yet). AIX 4.3.3 machines are fine. Has anybody else seen this? or know of a fix/APAR/PTF for it?
Oh yeah, we are also on ML04.
Thanks,
Tim