Cartesian product in Bash

Maybe you already know that, but Bash can generate a Cartesian product of number of given sets.

maciej@matilda ~ $ echo {in,out,on}{come,going}

income ingoing outcome outgoing oncome ongoing

Three sets is also not a problem.

maciej@matilda ~ $ echo {easy,hard}-{in,out}{come,going}

easy-income easy-ingoing easy-outcome easy-outgoing hard-income hard-ingoing hard-outcome hard-outgoing


Author: automatthias

You won't believe what a skeptic I am.

2 thoughts on “Cartesian product in Bash”

Comments are closed.