[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should -et be available?
From: |
Eli Schwartz |
Subject: |
Re: Should -et be available? |
Date: |
Mon, 25 May 2020 13:02:45 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
On 5/25/20 9:55 AM, Dennis Williamson wrote:
> With an OS/filesystem which supports subsecond file modification times
> neither -ot or -nt may be true if the seconds are the same (so far as
> expected) but the fractional seconds are different (so the file times are
> not actually equal). This may not be what you expect.
>
> $ cat /etc/lsb-release
> DISTRIB_ID=Ubuntu
> DISTRIB_RELEASE=18.04
> DISTRIB_CODENAME=bionic
> DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
> $ <CTRL-X><CTRL-V>
> GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
> $ # touch with delay - modification times not equal
> $ touch test1; sleep .001; touch test2; stat --format='%y %n' test1 test2
> 2020-05-25 08:38:26.209032136 -0500 test1
> 2020-05-25 08:38:26.221031929 -0500 test2
> $ [[ test1 -ot test2 ]] && echo older
> $ [[ test1 -nt test2 ]] && echo newer
> $ # touch with no delay - modification times equal
> $ touch test1 test2; stat --format='%y %n' test1 test2
> 2020-05-25 08:40:52.680722254 -0500 test1
> 2020-05-25 08:40:52.680722254 -0500 test2
> $ [[ test1 -ot test2 ]] && echo older
> $ [[ test1 -nt test2 ]] && echo newer
$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
[...]
$ <CTRL-X><CTRL-V>
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
$ touch test1; sleep .001; touch test2; stat --format='%y %n' test1 test2
2020-05-25 13:00:23.707169347 -0400 test1
2020-05-25 13:00:23.713836098 -0400 test2
$ [[ test1 -ot test2 ]] && echo older
older
$
$ touch test1 test2; stat --format='%y %n' test1 test2
2020-05-25 13:01:26.047939739 -0400 test1
2020-05-25 13:01:26.047939739 -0400 test2
$ [[ test1 -ot test2 ]] && echo older
$ [[ test1 -nt test2 ]] && echo newer
$
--
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User
signature.asc
Description: OpenPGP digital signature
Re: Should -et be available?, Peng Yu, 2020/05/25