Hello
stat is (generously) giving twice the expected output:
Code:
c@CW8:/tmp$ touch foo
c@CW8:/tmp$ ln foo bar
c@CW8:/tmp$ /bin/ls -l foo bar
-rw-r--r-- 2 c users 0 2010-03-07 00:17 bar
-rw-r--r-- 2 c users 0 2010-03-07 00:17 foo
c@CW8:/tmp$ stat foo --format '%h' foo
2
2
c@CW8:/tmp$ stat foo --format '%h' --terse foo
2
2
c@CW8:/tmp$ stat foo --format '%h %n' --terse foo
2 foo
2 foo
c@CW8:/tmp$ rm bar
c@CW8:/tmp$ stat foo --format '%h %n' --terse foo
2 foo
2 foo
c@CW8:/tmp$ stat foo
File: `foo'
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: 807h/2055d Inode: 442175 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ c) Gid: ( 100/ users)
Access: 2010-03-07 00:17:48.991592829 +0530
Modify: 2010-03-07 00:17:48.991592829 +0530
Change: 2010-03-07 00:22:23.299909243 +0530
c@CW8:/tmp$ type stat
stat is hashed (/usr/bin/stat)
c@CW8:/tmp$ stat --version
stat (GNU coreutils) 7.4
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Michael Meskes.
Is this a bug or have I misunderstood how stat works?
Best
Charles