Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 使用gnu parallel一次多个参数_Shell_Gnu Parallel - Fatal编程技术网

Shell 使用gnu parallel一次多个参数

Shell 使用gnu parallel一次多个参数,shell,gnu-parallel,Shell,Gnu Parallel,有没有可能让GNU并行地一次调用具有多个参数的命令,直到达到某个限制 为了解释起见,举个简单的例子 制作一些文件: seq 10 |平行触摸测试文件{}.txt 要删除它们,我可以执行以下操作:rm./test\u files*.txt 或等效于GNU并行:ls./test_files*.txt | parallel rm, 它为每个文件运行一次rm 有没有办法告诉GNU parallel以最大数量的参数运行命令,比如 ls ./test_files*.txt | parallel --max-

有没有可能让GNU并行地一次调用具有多个参数的命令,直到达到某个限制

为了解释起见,举个简单的例子

制作一些文件:
seq 10 |平行触摸测试文件{}.txt

要删除它们,我可以执行以下操作:
rm./test\u files*.txt

或等效于GNU并行:
ls./test_files*.txt | parallel rm
, 它为每个文件运行一次
rm

有没有办法告诉GNU parallel以最大数量的参数运行命令,比如

ls ./test_files*.txt | parallel --max-args 5 rm
这将启动

rm test_files1.txt test_files2.txt test_files3.txt test_files4.txt test_files5.txt
rm test_files6.txt test_files7.txt test_files8.txt test_files9.txt test_files10.txt

或者您可以使用
ls testfiles*.txt | parallel-X rm
,它将在每次调用
rm
时,根据您的操作系统的允许传递尽可能多的文件。
$ seq 10 | parallel --max-args 5 echo
1 2 3 4 5
6 7 8 9 10