xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Linux bash parallel `&` vs serial `&&` All In One

Linux bash parallel & vs serial && All In One

& 并行 vs && 串行

  1. & 是使用并行模式执行多个命令,同时并行执行左右边命令;

parallel 并行
concurrent 并发

  1. && 是使用串行模式执行多个命令,执行左边命令,执行右边命令 (先左后右,依次执行);

serial 串行

serially 串行

npm script

concurrently 同时/并发

https://www.npmjs.com/package/concurrently

demo

{
  "scripts": {
    "dev": "next dev",
    "start": "next start",
    "build": "next build",
    "parallel": "echo 并行 & next build & next export",
    "serial": "echo 串行 && next build && next export",
    "export": "next export",
    "lint-auto-fix": "next lint --fix",
    "lint": "next lint"
  },
}

# 并行 &
$ yarn parallel

## 串行 &&
$ yarn serial

Linux parallel and serial

https://www.cyberciti.biz/faq/how-to-run-command-or-code-in-parallel-in-bash-shell-under-linux-or-unix/

https://saveriomiroddi.github.io/Running-shell-commands-in-parallel-via-gnu-parallel/

https://stackoverflow.com/questions/29953990/run-serial-inside-paralell-bash

https://unix.stackexchange.com/questions/531753/running-multiple-jobs-a-combination-of-parallel-and-serial

refs

https://www.cnblogs.com/xgqfrms/p/16137768.html

https://github.com/xgqfrms/set-process-env/issues/5#issuecomment-1096808624



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-04-22 17:24  xgqfrms  阅读(97)  评论(1编辑  收藏  举报