-
Notifications
You must be signed in to change notification settings - Fork 0
/
steam-list-env-vars
executable file
·73 lines (68 loc) · 1.23 KB
/
steam-list-env-vars
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/sh
IFS="$(printf ' \t\n!')"; IFS="${IFS%!}"
unset -v \
switch_count
while test "${#}" -gt '0'; do
case "${1}" in
( '-c' \
| '--c' \
| '--co' \
| '--cou' \
| '--coun' \
| '--count' )
switch_count='TRUE'
;;
( '--h' \
| '--he' \
| '--hel' \
| '--help' )
printf '%s:\n' 'Usage'
printf ' %s [%s]...\n' \
"$(basename "${0}")" \
'OPTION'
echo
printf '%s\n' \
'Searches the Steam install directory for shell scripts and finds potential' \
'environment variables defined within.'
echo
printf '%s:\n' 'Options'
printf '%5s %-11s %s\n' \
'-c,' \
'--count' \
'display and sort by descending occurrence counts' \
'' \
'--help' \
'print this and exit'
exit
;;
(*)
printf '%s: %s\n' \
"$(basename "${0}")" \
'unrecognized option '\'"${1}"\' \
>&2
echo >&2
"${0}" --help >&2
exit
;;
esac
shift
done
PARAM_COUNT="${switch_count}"
(
IFS="$(printf '\n!')"; IFS="${IFS%!}"
cat $(
find "${STEAMROOT:-${XDG_DATA_HOME:-${HOME}/.local/share}/Steam}" \
-type f \
| grep -F '.sh'
) \
| sed -n 's/.*\(STEAM[_A-Z]*\).*/\1/p' \
| LC_ALL=C sort \
| (
if test "${PARAM_COUNT}"; then
uniq -c \
| sort -nr
else
uniq
fi
)
)