Skip to main content
5 of 6
Fixed comment link.
B Layer
  • 5.3k
  • 1
  • 21
  • 35

Omitting your other parallel flags just to stay focused...

parallel --link pf ::: A B ::: C D

This will run your function first with a=A, b=C followed by a=B, b=D or

a=A b=C
a=B b=D

Without --link you get full combination like this:

a=A b=C
a=A b=D
a=B b=C
a=B b=D

Update: As Ole Tange metioned in a comment there is another way to do this, the :::+ operator. There is an important difference between the two alternatives IF the number of arguments is not the same in each param position. An example will illustrate:

parallel --link pf ::: A B ::: C D E output:

a=A b=C
a=B b=D
a=A b=E

parallel pf ::: A B :::+ C D E output:

a=A b=C
a=B b=D

--link will "wrap" so all arguments are consumed while :::+ will ignore the extra argument. Personally I don't like when things are silently ignored so that's why my preference is --link. YMMV.

B Layer
  • 5.3k
  • 1
  • 21
  • 35