e3b9845b5378f8b82736ad1c7386b122f17c294c
[utils/utils.git] / stat2
1 #!/bin/bash
2 # stat2: Display just about everything about a file except its data -- Matt McCutchen
3
4 indent=$'|\t'
5 while [ "$#" != "0" ] ; do
6         echo "File $1"
7         echo "+-- Basic i-node information from \`stat':"
8         stat -- "$1" | sed -e "s/^/$indent/"
9         echo "+-- File version/generation and attributes from \`lsattr':"
10         lsattr -d -v -- "$1" | (read version attributes filenameignored && echo "$indent$version $attributes")
11         if [ ! -h "$1" ] ; then
12                 echo "+-- POSIX ACLs from \`getfacl':"
13                 getfacl --absolute-names --tabular -- "$1" | tail -n +2 | head -n -1 | sed -e "s/^/$indent/"
14         fi
15         echo "+-- Extended attributes in all namespaces from \`getfattr':"
16         getfattr --absolute-names -h -d -m '' -- "$1" | tail -n +2 | head -n -1 | sed -e "s/^/$indent/"
17         echo "'---------------------------------------"
18         shift
19 done