This is where you need to use awk.
awk -F ':' '/cpu cores/ {a = $2 + 1} END {print a}' /proc/cpuinfo awk -F ':' '/cpu cores/ {a = $2 + 1} END {print a}' /proc/cpuinfoI think need is a strong statement in this context.
echo $(( 1 + $(grep 'cpu cores' /proc/cpuinfo | head -1 | awk -F ':' '{print $2}') ))
Choosing shell vs. [insert modern] programming is a matter of trade-off of taste, time, $$$, collective consensus (in a team setting) and so forth.[edit]: Forgot code syntax on HN.