I'm trying to get the CPU's total load with this:
IDLE=$(mpstat | grep "all" | cut -c 92-) CPULD=$(expr 100 - $IDLE) echo $CPULD
but it always returns:
expr: non-integer argument on the second line.
I've looked around and everyone says that integers will be automatically recognized in strings, but it doesn't seem to be working.
EDIT: For those of you who wish to see my full and now-working script, it is here: http://pastebin.com/cFQzz4Up