Commit | Line | Data |
---|---|---|
273c3903 MM |
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':" | |
6ac3cd7b MM |
16 | # Add -P, otherwise the getfattr command printed xattrs of subdirectories |
17 | # when passed ~/cc (a symlink). I think this is a bug. TODO: report it. | |
18 | # ~ 2010-05-16 | |
19 | getfattr --absolute-names -h -d -m '' -P -- "$1" | tail -n +2 | head -n -1 | sed -e "s/^/$indent/" | |
273c3903 MM |
20 | echo "'---------------------------------------" |
21 | shift | |
22 | done |