我知道如何在与这样的模式匹配的所有子目录中运行命令(假设我想运行gh repo sync):
gh repo sync
for d in ./*/ ; do (cd "$d" && gh repo sync) ; done
并在每个目录的子shell中串行运行命令。
我想要的是并行运行所有命令,但在主脚本中等待它们全部完成。
我使用的是 Ubuntu 22.04。那可能吗?
ubuntu shell-script
shell-script ×1
ubuntu ×1