[BBLISA] Re: File::Stat from Bourne or Bash

bblisa at richfox.org bblisa at richfox.org
Mon Aug 15 09:22:47 EDT 2005


Hi,

D'oh! There does appear to be a stat command.
I'm not sure about how widely distributed it is. At least under FreeBSD
it's available under the linux compatibility package and on my
(4.2) installation it's at: /usr/compat/linux/usr/bin/stat
Anyways, the version I have returns output such as:

bash-2.04$ /usr/compat/linux/usr/bin/stat switchpitch.txt 
  File: "switchpitch.txt"
  Size: 2300         Filetype: Regular File
  Mode: (0664/-rw-rw-r--)         Uid: ( 1001/    rich)  Gid: (    0/
wheel)
Device: 116,5   Inode: 1500545   Links: 1    
Access: Sat Aug  6 17:20:23 2005(00008.15:52:06)
Modify: Thu Jul 14 08:54:52 2005(00032.00:17:37)
Change: Thu Jul 14 08:54:52 2005(00032.00:17:37)

Just checking a Fedora Core 3 installation and stat is also there, located
at /usr/bin/stat

[rich at backups ~]$ stat test.txt 
  File: `test.txt'
  Size: 0               Blocks: 0          IO Block: 4096   regular empty
file
Device: fd00h/64768d    Inode: 43647008    Links: 1
Access: (0664/-rw-rw-r--)  Uid: (  500/    rich)   Gid: (  500/    rich)
Access: 2005-08-15 09:08:21.000000000 -0400
Modify: 2005-08-15 09:08:21.000000000 -0400
Change: 2005-08-15 09:08:21.000000000 -0400

It does not appear to exist on MacOS X 10.3, but a variation does exist on
MacOS X 10.4:

[rfox:~] rfox% /usr/bin/stat spew_acids.pl 
234881027 980173 -rwxr--r-- 1 rfox rfox 0 160 "Jul 28 15:55:58 2005" "Oct
1 13:38:02 2004" "Oct  1 13:38:02 2004" 4096 16 0 spew_acids.pl

Why couldn't I find this before I asked?

Thanks,
Rich.


On Mon, 15 Aug 2005 bblisa at richfox.org wrote:

> Hi,
> 
> Does anyone know of a shell command that gives parsable output similar to
> perl's File::Stat or stat(2)? Ideally one that generally exists in BSD
> derivatives and Linux?
> 
> Thanks,
> Rich.
> 
> 





More information about the bblisa mailing list