博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux shell wait process finished,等待线程执行结束
阅读量:7184 次
发布时间:2019-06-29

本文共 787 字,大约阅读时间需要 2 分钟。

hot3.png

 

You can use the command wait PID to wait for a process to end.

You can also retrieve the PID of the last command with $!

In your case, something like this:

command1 & #run command1 in backgroundPID=$! #catch the last PID, here from command1command2 #run command2 while command1 is running in backgroundwait PID #wait for command1, in background, to endcommand3 #execute once command1 ended

Following your edit, as you have multiple PIDs and you know them, you can do that:

command1 & #run command1 in backgroundPID1=xxxxxPID2=yyyyyPID3=xxyyyPID4=yyxxxcommand2 #run command2 while command1 is running in backgroundwait PID1 PID2 PID3 PID4 #wait for the four processes of command1, in background, to endcommand3 #execute once command1 ended

转载于:https://my.oschina.net/u/2308739/blog/811118

你可能感兴趣的文章
存储类区块链项目落地的关键性能指标——QoS!
查看>>
《Java编程思想》笔记
查看>>
长春新高三数理化暑假复习训练/高中理综补习班推荐
查看>>
JS中this的绑定规则
查看>>
Flutter入门进阶之旅(十六)Scaffold 脚手架
查看>>
Android进阶:九、自定义View之手写Loading动效
查看>>
每日一道面试题(第1期)---自定义handler如何有效保证内存泄漏问题
查看>>
红宝书总结-执行环境、作用域链
查看>>
sklearn 多项式回归
查看>>
iOS__播放mp3文件根据光线传感器设置外置或者听筒播放
查看>>
JS数组
查看>>
python(1)汇率换算
查看>>
spring cloud微服务分布式云架构- Config 快速开始
查看>>
十一课堂|通过小游戏学习Ethereum DApps编程(1)
查看>>
【区块链+游戏实践】火币区块链产业专题报告-游戏产业的割裂与重构
查看>>
批量删除Maven下载失败的文件及文件夹
查看>>
前端学习是个无底洞,要给自己一个定位
查看>>
使用 ELK 来分析你的支付宝账单
查看>>
[Android] 列表控件(RecycleView,GridView)
查看>>
vue源码阅读,学习vue的rollup打包工具,write一个自己的工具函数库
查看>>