X-Git-Url: https://git.xandkar.net/?a=blobdiff_plain;f=home%2Flib%2Flogin_functions.sh;h=87746c69006162436465ac7eae16d4f80b888f5b;hb=94df2def5a3ab95bca8cdef99301d1cc39b8cab1;hp=e006eee32825e21e395e9fea93f8e4d19ec4c85a;hpb=d265cd11ac471b7d2596ac1c41b81e64094b788e;p=khome.git diff --git a/home/lib/login_functions.sh b/home/lib/login_functions.sh index e006eee..87746c6 100644 --- 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 '