help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to check a file's modify time is at epoch 0?


From: Andy Chu
Subject: Re: How to check a file's modify time is at epoch 0?
Date: Sun, 27 Oct 2019 15:31:55 -0700

You're already using touch and stat, in which case this is much simpler:

test "$(stat --format '%Y' 0.txt)" = 0

(with GNU coreutils at least)

Andy


On Sun, Oct 27, 2019 at 2:34 PM Peng Yu <address@hidden> wrote:
>
> Hi,
>
> I use the following code to check if 1.txt's modify time is at epoch
> 0. But it is not very convenient.
>
> set -v
> touch -d @0 {0,1}.txt
> stat 0.txt
> [[ ! 0.txt -nt 1.txt && ! 0.txt -ot 1.txt ]]
> echo "$?"
>
> Is there any better way to do so in bash? Thanks.
>
> --
> Regards,
> Peng
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]