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: Peng Yu
Subject: Re: How to check a file's modify time is at epoch 0?
Date: Sun, 27 Oct 2019 18:29:36 -0500

Thanks. But I am looking for something native to bash. Involvement
with external programs will slow down the run time.

On 10/27/19, Andy Chu <address@hidden> wrote:
> 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
>>
>


-- 
Regards,
Peng



reply via email to

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