shell并发处理

1.脚本效果

2.脚本内容


#!/bin/bash

echo "Test concurrent execution"
start=$(date +%s)
for ((i=0; i<5; i++))
do
{
    sleep 2
    echo "Done $i"
} &
done
wait
end=$(date +%s)
take=$((end-start))
echo "Concurrent execution take time(s): $take"