bash - bash - 执行多个进程,然后执行另一个
问题描述
我正在尝试做类似以下的事情:
(task1 & task2) && echo "finished task1 and task2" && task3
目标是task1
andtask2
将同时执行,一旦 BOTH 完成,后一个命令将被执行(echo
然后task3
)
那可能吗?
解决方案
只需使用:
task1 &
task2 &
wait # for both task1 and task2 to finish
echo "finished task1 and task2"
task3
推荐阅读
- angular - 如何计算Angular中数组的概率?
- python - 使用 PySCIPOpt 限制求解时间(Python 的 SCIP ILP 优化)
- javascript - 使用数组中的关键字验证文本字段中的文本,如果正确则显示表单
- php - 类 'App\GraphQL\Query\GraphQL' 未找到错误虽然包含在配置/应用程序中 - 服务提供者和别名
- c - 高强制级别应用程序的持久性 - windows
- r - geom_area 在层之间产生空白区域
- c# - 如何通过 Activator.CreateInstance 实例化对象并使用 Dapper 将其插入表中
- excel - Excel VBA 事件 - 单击了自动筛选按钮
- python - Python + Pandas:复制多个 CSV 第一行的特定列并将这些行存储到单个 csv
- python - Python中给定字符串中换行符搜索的正则表达式