Oh, sorry,
Thank your for having corrected me !
Regards.
Christophe
Le 04/09/18 à 12:56, Otto Moerbeek a écrit :
On Mon, Apr 09, 2018 at 12:50:33PM +0200, Christophe Simon wrote:
The command I executed was run on OpenBSD:
$ uname -a
OpenBSD XXX 6.3 GENERIC.MP#107 amd64
$ /bin/date -d 'now -1 day' '+%Y_%m_%d'
2018_04_09
$ /bin/date -d 'yesterday' '+%Y_%m_%d'
2018_04_09
I don't know when it was imported into BSD's date, but this extension is
available on OpenBSD, at least in 6.3...
There is a -d option, but it does not do what you expect. What
date is it now? Try other values than -1
-Otto
Regards.
Christophe
Le 04/09/18 à 10:54, Otto Moerbeek a écrit :
On Mon, Apr 09, 2018 at 10:38:11AM +0200, Christophe Simon wrote:
Hi,
You can use this form, which is a little simpler:
date -d 'now -1 day' '+%Y_%m_%d'
Nope, this is a GNU extension.
-Otto
Regards
Christophe
Le 04/09/18 à 07:54, Robert Klein a écrit :
Hi Max,
this works for me:
date -r $(( $(date +%s) - 1 * 24 * 60 * 60 )) +%Y_%m_%d
Best regards
Robert
On Mon, 09 Apr 2018 07:45:05 +0200
Max Power <open...@cpnetserver.net> wrote:
Hi guys,
How can I do to get yesterday's date?
I need for create a backup directory.
On Linux:
yesterday=backup_$(date -d "yesterday" '+%Y_%m_%d')
mkdir -p /raid1/backup/$yesterday
Thanks for reply.