home
/
code
/
khome.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d265cd1
)
Implement shell_activity_report function
author
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 22 Dec 2019 16:19:43 +0000
(11:19 -0500)
committer
Siraaj Khandkar
<siraaj@khandkar.net>
Sun, 22 Dec 2019 16:19:43 +0000
(11:19 -0500)
home/lib/login_functions.sh
patch
|
blob
|
blame
|
history
diff --git
a/home/lib/login_functions.sh
b/home/lib/login_functions.sh
index
e006eee
..
87746c6
100644
(file)
--- a/
home/lib/login_functions.sh
+++ b/
home/lib/login_functions.sh
@@
-5,6
+5,31
@@
d() {
dict "$word"
}
+shell_activity_report() {
+ history \
+ | awk '
+ {
+ time = $3
+ ok = split(time, t, ":")
+ if (ok) {
+ hour = t[1] + 0 # Coerce number from string
+ cnt = count[hour]++
+ }
+ if (cnt > max)
+ max = cnt
+ }
+
+ END {
+ for (hour=0; hour<24; hour++) {
+ c = count[hour]
+ printf "%2d ", hour
+ for (i=1; i<=((c * 100) / max); i++)
+ printf "|"
+ printf "\n"
+ }
+ }'
+}
+
top_commands() {
history \
| awk '
This page took
0.0304 seconds
and
4
git commands to generate.