Hi,
You can use this form, which is a little simpler:
date -d 'now -1 day' '+%Y_%m_%d'
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.