我如何执行并行的"for"操作?在Bash中循环吗?

问题描述:

我一直在尝试并行化以下脚本,特别是for循环.我该怎么办?

I have been trying to parallelize the following script, specifically the for loop. How can I do that?

#!/bin/bash
for i in `cat /root/vms`;
do
    /usr/bin/sshpass -p 'test' /usr/bin/ssh -o StrictHostKeyChecking=no \
        -l testuser $i -t 'echo test | sudo -S yum update -y'
done

替换

/usr/bin/sshpass ...

使用

/usr/bin/sshpass ... &