# !/bin/bash # how many cpu cores are in the machine? CPU=`/bin/cat /proc/cpuinfo | /bin/grep proc | /bin/awk '{ print $3 }' | /usr/bi n/tail -n 1` CPU=$(($CPU + 1)) # run as many instances as there are cpu cores in the machine for ((i=1; i <= CPU ; i++)) do echo "hi" #do stuff here done