Linux - Shell脚本并行运行curl命令

Nag*_*n S 5 linux shell

我想创建linux shell脚本来并行运行CURL命令

例如:我有三个命令

  1. curl -s http://localhost/process.php?id = 1
  2. curl -s http://localhost/process.php?id = 2
  3. curl -s http://localhost/process.php?id = 3

我想同时调用上面三个命令.

任何帮助表示赞赏.

小智 8

我认为一个bash脚本如:

#!/bin/bash

curl -s http://localhost/process.php?id=1 &
curl -s http://localhost/process.php?id=2 &
curl -s http://localhost/process.php?id=3 &
Run Code Online (Sandbox Code Playgroud)

但是,这将作为后台进程启动所有任务.不知道同时启动过程有多重要.