[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] bash native way to support test file is older than a cer
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] bash native way to support test file is older than a certain period of time |
Date: |
Mon, 10 Jun 2019 09:06:57 -0400 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Sun, Jun 09, 2019 at 10:51:51PM +0200, Andreas Kusalananda Kähäri wrote:
> The other alternative is to use find:
>
> if [ -n "$( find "$myfile" -mmin +60 -print)" ]; then
> echo file was modified more than 60 minutes ago
> fi
>
> (where "$myfile" is some path to a file)
>
> There's nothing "bash native" about that though, but it would be
> portable.
Portable to any system with GNU find, you mean (the -mmin test isn't
standard). It also assumes the filename is not just one or more newline
characters, but that might be getting a little bit too pedantic.