Geremia
Geremia

Reputation: 5656

How do I pass no arguments to GNU Parallel?

How do I pass no arguments to GNU Parallel? Basically, I'd like to loop a command:

parallel --dry-run command_to_repeat ::: `seq 100`

passes the arguments:

command_to_repeat 1
command_to_repeat 2
command_to_repeat 3
command_to_repeat 4
command_to_repeat 5
command_to_repeat 6
command_to_repeat 7
command_to_repeat 8
command_to_repeat 9
command_to_repeat 10
…

But I'd like:

command_to_repeat
command_to_repeat
command_to_repeat
command_to_repeat
command_to_repeat
command_to_repeat
command_to_repeat
command_to_repeat
command_to_repeat
command_to_repeat
…

Upvotes: 1

Views: 75

Answers (1)

Geremia
Geremia

Reputation: 5656

From the docs, § "EXAMPLE: Run the same command 10 times":

If you want to run the same command with the same arguments 10 times in parallel you can do:

seq 10 | parallel -n0 my_command my_args

🎩-tip: Dan Getz

From the manpage:

   -n max-args
       Use at most max-args arguments per command line.

Upvotes: 1

Related Questions