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 <[email protected]> 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.
> > >
> >
> >