I know that the curly braces expansion is handled by the shell, not the command e.g. echo. When there are too many permutations, it takes too long as well as too many memory BEFORE entering the command. Is it possible to let the first permutation feed into the command, then the second permutation, and so on. It is because I have a check condition in the command, such that if certain permutation matches, it will be stopped.
echo {a,b,c,d,}{a,b,c,d,}{a,b,c,d,}{a,b,c,d,}{a,b,c,d,}{a,b,c,d,}{a,b,c,d,}{a,b,c,d,}{a,b,c,d,}
It can be done by many for loops in a shell script. But it would be convenient if there are certain syntax allow the same behaviour.
Here is an idea to generate the permutations with recursion by using the given string of curly braces.
Although it instantly starts to generate the permutations, it may take a longer time to complete than the brace expansion of bash. If this is not practical in execution time, I'll update my answer with more efficient code using other languages such as perl.