-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathinfo.awk
executable file
·87 lines (85 loc) · 1.62 KB
/
info.awk
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/awk -f
# Created by yrmt.
function os() {
FS="\:\t"
while("sw_vers"|getline) {
printf("%s ", $2);
}
printf("\n");
}
function cpu() {
while("sysctl -n machdep.cpu.brand_string"|getline) {
print;
}
}
function ram() {
while("sysctl -n hw.memsize"|getline) {
printf("%d MB\n",$1/1e+06);
}
}
function model() {
while("sysctl -n hw.model"|getline) {
print;
}
}
function disk() {
FS="\ "
while("df -h"|getline) {
if(/disk0s2/) {
print $5;
}
}
}
function gpu() {
FS="\:\ "
while("system_profiler SPDisplaysDataType"|getline) {
if(/Chipset/) {
chipset=$2;
}
if(/VRAM/) {
vram=$2;
}
}
print chipset " @ " vram
}
function pkg() {
while("pkgin ls|wc -l"|getline) {
gsub(/\ /, "");
print;
}
}
function shell() {
print ENVIRON["SHELL"];
}
function term() {
print ENVIRON["TERM"];
}
function kernel() {
while("uname -rms"|getline) {
print;
}
}
function uptime() {
FS=","
while("uptime"|getline) {
print $1;
}
}
function main() {
n="\033[0m" # Reset
r="\033[1;31m" # RED
printf(r"OS: "n);os();
printf(r"Kernel: "n);kernel();
printf(r"Model: "n);model();
printf(r"Processor: "n);cpu();
printf(r"Graphics: "n);gpu();
printf(r"Disk: "n);disk();
printf(r"Ram: "n);ram();
printf(r"Packages: "n);pkg();
printf(r"Shell: "n);shell();
printf(r"Terminal: "n);term();
printf(r"Uptime: "n);uptime();
}
BEGIN {
main();
}