...
Quote:>Two incorrect solutions are commonly given every time this question is
>asked here, one of them being specific to GNU date (passing
>nonstandard options to the date command) and the other being
>nonportable (using illegal timezone offsets, which works on some
>systems but not others).
I find it curious that you call using GNU date an incorrect solution.
In my opinion, it is the only correct solution. If you are going to do any
kind of serious shell scripting, you need GNU date (*) in order to handle
the date manipulation, so you might as well bite the bullet, get it, and
get it over with. You'll be glad you did.
(*) Or some other compiled utility, such as ADU. But, when all is said and
done, GNU date is the most straightforward solution.
Oh, and, by the way, here is a shell script to display yesterday's date,
that should work, more or less, on any system. Note: This is largely a
joke and is psuedo-code, so don't both writing back and telling me that you
couldn't get it to work...
#!/bin/sh
set -e
cd /tmp
wget ftp://ftp.gnu.org/sh-utils/sh-utils.tgz
tar xzvf sh-utils.tgz
cd sh-utils
./configure;make;./date -d yesterday