How to print all possible combinations of a word in Bash?

How to print all possible combinations of a word in Bash?

I want to write a bash script to print all possible lower and upper case permutations of a certain word, e.g. harley: harley harleY harlEy harLey HARLey HARLEy HARLEY However, I would have to code the script for a different word again. Is there a better way to accomplish this?

Is there elegant way to do this in Bash?

So I want to do generate all possible combinations of lower and upper case characters and numbers that can make up a 5 character string. Possibilities: a..z, A..Z and 0..9. Is there any elegant way of doing this in bash at all?

Can you do the same loop in Bash?

You can do that same loop in bash, but bash being the slowest shell in the west, that’s going to take hours: (on my system, that outputs at 700 kiB/s as opposed to 20MiB/s with the perl equivalent). Here’s a way to do it purely in bash without having to chomp 5 GB of memory:

Is there a way to make a bash script work?

I need the solution to work in a bash script. In all fairness, I could call Python, PHP, etc. Any input is greatly appreciated. Yet Another Bash solution, based on IVlad’s binary iteration method, also borrowing the brace expansion idea from Cyrus with Malte Skoruppa’s generalization:

How to do all possible combinations of characters and numbers?

Gnu Parallel can do combinations see https://www.gnu.org/software/parallel/ Something like this: Thanks for contributing an answer to Unix & Linux Stack Exchange! Please be sure to answer the question. Provide details and share your research! But avoid … Asking for help, clarification, or responding to other answers.

How to get all possible combinations in lowercase?

If you prefer to use ready tools instead of coding, you can use TextMechanic (permutation/combination generator tool) and Unit-Conversion.info Thanks for contributing an answer to Unix & Linux Stack Exchange!