commit 92fef18025ec34517a37ad8ff913f997d52f077a parent 4af49af47d84eb522ded7e2c238346b095010c5f Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Tue, 20 Oct 2020 10:21:49 +0200 temptest: use simpler syntax for awk conditional Diffstat:
M | .local/bin/temptest | | | 10 | ++-------- |
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/.local/bin/temptest b/.local/bin/temptest @@ -22,14 +22,8 @@ get_speed() { sysctl -n hw.cpuspeed else awk ' - { - if (match($0, /cpu MHz/)) { - avg += $4; n++ - } - } - END { - print avg/n - }' /proc/cpuinfo + /cpu MHz/ { avg += $4; n++ } + END { print avg/n }' /proc/cpuinfo fi }