This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cpu_last_sum=0 | |
while :; do | |
# get the first line with aggregate of all CPUs | |
cpu_now=($(head -n1 /proc/stat)) | |
# get all columns but skip the first (which is the "cpu" string) | |
cpu_sum="${cpu_now[@]:1}" |