[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: |
Chet Ramey |
Subject: |
Re: How to check a file's modify time is at epoch 0? |
Date: |
Wed, 30 Oct 2019 17:47:49 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
On 10/27/19 10:00 PM, Eli Schwartz wrote:
> On 10/27/19 7:29 PM, Peng Yu wrote:
>> Thanks. But I am looking for something native to bash. Involvement
>> with external programs will slow down the run time.
>
> No, there is no bash builtin that lets you stat the filesize directly.
>
> I was going to say, assuming your distribution of bash included the
> built contents of examples/loadables/, you could use the example
> loadable 'finfo'. However,
>
> $ enable -f /usr/lib/bash/finfo finfo
> -bash: enable: cannot open shared object /usr/lib/bash/finfo:
> /usr/lib/bash/finfo: undefined symbol: minor
>
> Other loadables provided in my Arch Linux package work fine, just this
> one does not.
>
> Chet -- when I try to compile finfo.c, I get this warning:
>
> finfo.c: In function ‘printst’:
> finfo.c:277:7: warning: implicit declaration of function ‘major’
> [-Wimplicit-function-declaration]
> 277 | ma = major (st->st_rdev);
> | ^~~~~
> finfo.c:278:7: warning: implicit declaration of function ‘minor’
> [-Wimplicit-function-declaration]
> 278 | mi = minor (st->st_rdev);
> | ^~~~~
>
> If I add an #include <sys/sysmacros.h> then it compiles okay and I can
> load it and it works as expected.
Interesting. On Linux, <sys/sysmacros.h> is usually included from
<sys/types.h> if __USE_BSD is defined (as it is, apparently, on RHEL,
through one of the twisty maze of defines in <features.h>).
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU address@hidden http://tiswww.cwru.edu/~chet/
signature.asc
Description: OpenPGP digital signature