use nproc utility to calculate number of cores

  as i peruse your scripts, i can offer some suggestions for cleanup.
for example, to count the number of cores, get rid of all that
grep/awk/head stuff, and use the "nproc" command that's part of
coreutils:

$ nproc
8
$

on my quad-core with hyperthreading.

Reported-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>