Shell多进程模式

多进程模式

#! //bin/bash
startTime_s=`date +%s`

endTime_s=`date +%s`

for i in $(seq 1 100)
do
  {
        sleep 10
        echo "${i} 进程执行完毕"
        name=$(head /dev/urandom |cksum |md5sum |cut -c 1-4)
        echo "${name}"
  }&
done

wait
sumTime=$[ $(date +%s) - $startTime_s ]
echo "Total:$sumTime seconds"

Last updated