Hello,
So my knowledge of bash scripting is not that great and I have been trying to solve this problem on my own for awhile to no avail.
Here's the error I get when running it with an OS that uses bash 3.2.x:
testagain.sh: line 10: -1: syntax error: operand expected (error token is "-1")
Here's the script (sorry for the lack of indents not sure how the formatting on this forum works):
#!/bin/bash
cd /home/sites
for logdir in */logs; do
for access_log in ${logdir}/access_log.*; do
lognum=`echo $access_log | sed -e 's/.*access_log\.//'`;
lognum=$(($lognum-1));
mv $access_log ${logdir}/access_log-$(date -d"- $lognum days" '+%Y%m%d');
done
done