Jump to content

Bash: Composing all variations of 9 letters

MrKickkiller

Hi

 

i'm looking for a simple way to compose all variations of 9 letters of which there must at least be 4 used and 1 (the fifth argument to the script) must always be used.

 

I had already been thinking of making a 9 nested for loops, but I don't think that will do the trick since it is not very scalable...

 

Thx.

That time I saved Linus' WiFi pass from appearing on YouTube: 

A sudden Linus re-appears : http://linustechtips.com/main/topic/390793-important-dailymotion-account-still-active/

Link to comment
Share on other sites

Link to post
Share on other sites

I'm going to try and reword this to see if I understand what you're looking for.

 

You want a script that takes 5 arguments and generates a string of length 9 for every permutation of the input arguments. Additionally, the output string must always contains at least 1 copy of the 5th argument.

 

Example Input:

 

A,B,C,D,Q

 

Example Output:

 

AAAAAAAAQ

AAAAAAABQ

...

DDDDDDDDQ

...

QQQQQQQQQ

 

Is this what you're asking for?

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×