shell 多进程来模拟多线程

(1){ } 建立代码块

(2)使用 & 将进程放入后台

[[email protected] ~]$ cat threads.sh 
#!/bin/bash

for ((i=0;i<5;i++))
do
{
    sleep 3
    echo $i>>aa && echo $i
}&
done
wait
cat aa | wc -l
rm aa

result

shell 多进程

相关文章:

  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-07-28
  • 2021-04-07
猜你喜欢
  • 2021-05-20
  • 2021-11-04
  • 2021-10-25
  • 2021-11-16
  • 2021-07-20
  • 2022-02-18
相关资源
相似解决方案