Small problem

hello, i am a newbie and i really need your help

i have an centos 6.5 and i wonder if i can create a list with random 4 letters :

gdjf
ornc
tyrn
jfdn
nofd 
etc....

if it can be done , i will really apreciate your help ! THANKS !!!

---------- Post updated at 07:16 AM ---------- Previous update was at 07:13 AM ----------

ohhh...i forgot ....

i want to use all letters....all posibilities.....

Any attempts from your side?

no...i dont know how to do it ....i thought there is a scrypt or something

Is it homework?

1 Like

Withdrawn until DukeNuke2's question is answered...

not really a homework.....i want to have all posibilities for 4 letters wich will help me for another project. a friend of mine told me about this forum....he said you always help...
maybe i didnt explain corectly but i really hope to solve this. thx !

You didn't mention the shell you are using. Anyhow, with a recent bash , try

RD=( {A..Z} {a..z} )
echo ${RD[$((RANDOM%52))]}${RD[$((RANDOM%52))]}${RD[$((RANDOM%52))]}${RD[$((RANDOM%52))]}
jTyG
1 Like

no...i dont.....
the task looks like this : can you find out how many possibilities are for 4 letters ? and if yes , can you have a list with them ? i am sorry....i never worked with this....a friend told me about this forum and he said you guys helped him alot. thank you !

---------- Post updated at 02:00 PM ---------- Previous update was at 01:59 PM ----------

only small letters.....not capital !

456976

for i in {a..z}; do
 for j in {a..z}; do
  for k in {a..z}; do
   for l in {a..z}; do
    echo $i$j$k$l
   done
  done
 done
done

This has nothing to do with *nix: it's the number of chars raised to the power of count of positions: 26 ^ 4 = 456976. Given your specification will not change again, e.g. duplicates allowed in the string, permutations allowed, etc.

If you do only printing...and have enough memory...

printf "%s\n" {a..z}{a..z}{a..z}{a..z}
printf "%s\n" {a..z}{a..z}{a..z}{a..z} | wc -l
 456976