So, the value the $backupdte variable is just some day of the month, like 1,2,3,...31 ? Not something like "09312004" or similar?
Doesn't the day of the week make any difference for the week-number? I mean, if $backupdte is "2" should the script always calculate the week number to be "1", no matter if "2" is on a saturday, or a monday?
OK, I assume it's just 1,2,3...31 and the day of the week doesn't matter. Then use:
Code:
#!/bin/bash
serial=$((1+($backupdte-1)/7))
echo $serial
If you want the weeknumber of the current date:
Code:
serial=$((1+($(date +%e)-1)/7))