使用 xargs 启动多个 "while read" 命令

launch several "while read" commands with xargs

我有一个文件,其中包含这样的命令列表

while read line;do tabix ftp://.../myfile.gz. >> output.vcf; done < input.txt

我想将这个包含 45 个命令的列表传递给 xargs。

我正在尝试呼叫:

cat mycommands.txt | xargs -P45 -n10 bash 但我不确定 bash 是否理解 >>> 作为参数并且它不起作用。 有人看到我没看到的东西吗?一个错误... 非常感谢您!

您是否尝试使用 -I 标志?

像这样

cat mycommands.txt | xargs -P45 -n10 -I {} bash -c {}

如 xargs 手册页中所示:

Replace occurrences of replace-str in the initial-arguments with names read from standard input.

亲切的问候