shell多线程

  sre

单线程:
#!/bin/bash
for((i=0;i<5;i++));do echo $i done echo 'test' 0 1 2 3 4 test 多线程: #!/bin/bash for((i=0;i<5;i++));do echo $i & done echo 'test' 0 1 test 4 2 3 未按顺序输出 增加wait: #!/bin/bash for((i=0;i<5;i++));do echo $i & done wait echo 'test' 0 1 2 3 4 test

LEAVE A COMMENT

Captcha Code