I am trying to use the bash function RANDOM to create a random string that consists of 8 character from a variable that contains integer and alphanumeric digits (eg: var="abcd1234ABCD")
Thank you.
I am trying to use the bash function RANDOM to create a random string that consists of 8 character from a variable that contains integer and alphanumeric digits (eg: var="abcd1234ABCD")
Thank you.
Use parameter expansion.
${#chars}
is the number of possible characters,%
is the modulo operator.${chars:offset:length}
selects the character(s) at positionoffset
, i.e. 0 - length($chars) in our case.Using sparse array to shuffle characters.
(Or alot of random strings)