-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjtool-stat
executable file
·57 lines (47 loc) · 1.15 KB
/
jtool-stat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
# Usage: jtool-stat [OPTIONS] FILE...
########################################################################
# Bash environment
########################################################################
# Safety
set -o errexit \
-o pipefail \
-o nounset \
-o noclobber
# Extensions
set +o posix
shopt -s lastpipe
shopt -s expand_aliases
shopt -s extglob
shopt -s globstar
########################################################################
# Handle private protocol
########################################################################
if (( $# == 1 )); then
case $1 in
-\?) exec stat --help ;;
-\:) exec cat <<SYNOPSYS
jtool CMD
CMD sinopsys...
SYNOPSYS
exit 0
;;
esac
fi
########################################################################
# Command
########################################################################
# `stat` with JSON output!
stat --printf '{
"mode": "%A",
"nlink": %h,
"uid": "%u",
"user": "%U",
"gid": "%g",
"group": "%G",
"size": %s,
"mtime": "%y",
"name": "%n"
}'"\n" "${@}"
exit
# vim:syntax=sh:et:sw=4:ts=4:ai