I'm looking for a one liner that will achieve something like this (with 2 or more argument strings):$ make_combinations 1 2 a b c1 a1 b1 c2 a2 b2 cOf course I could make nested for loops, but if there is a generic and fast way to achieve this, it would be better. This would be very useful to use with xargs.Thanks in advance!
How to list all combinations of words?
bash
printf %s\n {1,2} {a,b,c}1 a1 b1 c2 a2 b2 cOrecho {1,2} {a,b,c} | xargs -n 21 a1 b1 c2 a2 b2 cAs @George Vasiliou mention in his comment when the list can be wriiten as a range you can use it as below:printf '%s\n' {1..2} {a..c} 