xargs "too long argument list"

You can try using xargs's -n:

Use at most max-args arguments per command line.

Also worth noting xargs can be made to

Print the command line on the standard error output before executing it.

with -t, which is rather useful for debuging.


The problem sounds like you should not be using -0, -0 is for when you have your arguments in the file separated by null characters instead of $IFS which is usually whitespace. If the file is formatted with one argument per line or with arguments separated by whitespace, omit the -0.

I'm also guessing that you don't intend it to run openssl prime arg1 arg2 arg3 arg4...." but instead runopenssl prime arg1then runopenssl prime arg2, thenopenssl prime arg3, etc, in which case, add the -1 switch as well, which is shorthand for-n 1`, if you really want to run one invocation of openssl per line of the file, you want:

xargs -1 openssl prime < 5.txt

or with the uuoc (useless use of cat)

cat 5.txt | xargs -1 openssl prime

on a non-gnu xargs which doesn't know the -1 option this would be:

xargs -n1 openssl prime < 5.txt