xargs“太长的参数列表”

我想要做这样的事情:

cat 5.txt | xargs -0 openssl prime 

但是xargs是说参数列表太长了


编辑:

 cat 3.txt | xargs -n 1 openssl prime | wc -l 

作品,谢谢

你可以尝试使用xargs-n

每个命令行最多使用max-args参数。

xargs也值得注意

在执行标准错误输出之前打印命令行。

-t ,这对debugging非常有用。

这个问题听起来像你不应该使用-0,-0是当你的文件中的参数分隔空字符,而不是$ IFS通常是空白的。 如果文件的格式为每行一个参数或参数用空格分隔,则省略-0。

我也猜测你不打算运行openssl prime arg1 arg2 arg3 arg4...." but instead run openssl prime arg1, then run openssl prime arg2 , then openssl prime arg3 , etc, in which case, add the -1 switch as well, which is shorthand for -n 1的, etc, in which case, add the -1 switch as well, which is shorthand for ,如果你真的想运行一行openssl文件的每一行,你需要:

 xargs -1 openssl prime < 5.txt 

或与uuoc(无用的猫)

 cat 5.txt | xargs -1 openssl prime 

在一个非gnu xargs不知道-1选项这将是:

 xargs -n1 openssl prime < 5.txt