On Thu, Mar 31, 2011 at 01:41:22PM +0100, Richard Parsons wrote:
date -d yesterday +%a works for me.
Sadly my WD NAS doesn't know about 'yesterday' :-
root@backup# date -d yesterday +%a date: invalid date `yesterday' root@backup#
The NAS uses busybox for the bulk of its commands and 'date' is among those so I guess it's a fairly limited implementation.
Ah, busybox.
http://www.google.co.uk/search?q=busybox+date+yesterday
There's a solution here. Basically, you convert today's date into a number of seconds and then less 86400, before re-converting to a string.
I had considered that but wasn't convinced I could work out the exact syntax needed to do it, that link shows what's needed:-
date -D %s -d $(( $(date +%s) - 86400)) +%a
... obvious really!? :-)
Thank you.