There is a problem - need to store the database backup on the FTP. On the FTP should not be more than 10 back-ups, ie, After you add backup to FTP should be removed, the old
It has passed several years, and while Graeme's answer helped me but I faced some problems with it and here is how to fix them.
Sometimes the sentence like Trying aaaa:bbb:ccc:ffffdd::0... is at first line of listing varable. You have to remove it.
rem="Trying aaaa:bbb:ccc:ffffdd::0...";
rep="";
listing=${listing/$rem/$rep}
Also jsan commented he faced other issue: "value too great for base (error token is "08")" when $DD is 0x it is interpreted as x in octal (problem for 8 and 9)
I faced same problem. So you better make sure there is no nun-numeric characters in $MM or $DD and then remove the 0 from beggining. Like 08 should become 8.
so before looping on files, add this code:
MM=$(tr -dc '0-9' <<< $MM)
DD=$(tr -dc '0-9' <<< $DD)
MM=${MM#0}
DD=${DD#0}
First two lines remove non-numeric characters and second last lines fix the problem with 08