bash - 如何一次运行所有命令

标签 bash centos tmux

我有一个看起来像这样的脚本

cd /root/signedsh/apps
for i in $(find . -name *_Seyed.ipa) ; do
#echo $i
./sign -k "/root/cert/appX.p12" -m "/root/profile/appX.mobileprovision" -p "udidsigning" -z 9 -o "$i" "$i"
done

现在这对于前 10 个文件来说工作得很好,但是现在我有 300 个文件我需要运行那个 ./sign 命令

目前,它等待第一个命令完成,然后使用第二个命令(for i in $(find . -name *_Seyed.ipa) ; do)运行它

有没有办法可以同时运行所有 300 个左右?服务器在大型 nvme raid 0 上是 48 核和 256GB ddr4,所以它不应该挣扎,我只是不知道该怎么做

最佳答案

在后台运行每个命令(不要使用 find ):


shopt -s globstar
cd /root/signedsh/apps
for i in **/*_Seyed.ipa ; do
  ./sign -k "/root/cert/appX.p12" \
         -m "/root/profile/appX.mobileprovision" \
         -p "udidsigning" -z 9 -o "$i" "$i" &
done

关于bash - 如何一次运行所有命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61386993/

相关文章:

bash - 使用 .publishsettings 文件登录 Azure

bash - zsh 循环多个参数

python - centos 7启动firewalld失败

php - 如何找出运行 PHP 的进程? (Litespeed/Centos环境)

tmux - 如何让 tmux 提示我显示状态左侧文本?

macos - tmux 在 OS X 上的什么地方保存日志

bash - shell 脚本 : how to read a text file that does not end with a newline on Windows

python - 数据打印时防止终端字符集切换

bash - 保持 FFMPEG 编码 session 运行

docker - 将环境变量保持在窗口拆分状态