Shell script randomly generates 10 8-bit passwords

Time:2022-5-8

Randomly generate 10 8-bit password shell scripts
1. First capital letter
2. Random mixing of upper and lower case letters and numbers in the middle six digits
3. Eighth place [0-9]

#!/bin.bash
for i in {1..10}
do
A=`head -c 500 /dev/urandom | tr -dc a-zA-Z | tr [a-z] [A-Z]|head -c 1`
B=`head -c 500 /dev/urandom | tr -dc a-z0-9A-Z | head -c 6`
C=`echo $RANDOM|cut -c 2`
echo $A$B$C
done
 
 
--------------------------------
#!/bin.bash
for i in {1..10}
do
A=`head -c 500 /dev/urandom | tr -dc A-Z |head -c 1`
#Randomly generate 500 characters | take only uppercase letters | take the first character
B=`head -c 500 /dev/urandom | tr -dc [:alnum:]| head -c 6`
#Randomly generate 500 characters | take English upper and lower case bytes and numbers, that is, 0-9, A-Z, A-Z | take 6 bits
C=`echo $RANDOM$RANDOM|cut -c 2`
#Take the second random number. The first random number is not high. Most of them are 1 or 2, so take the second
echo $A$B$C
done

The above is the whole content of this article. I hope you can like it.

Recommended Today

Operation flow of stateless in. Net

introduce What are state machines and state patterns State machine is a tool for object modeling. It is a directed graph, which is composed of a group of nodes and a group of corresponding transfer functions. The state machine “runs” in response to a series of events. Each event is within the control range of […]