-
Notifications
You must be signed in to change notification settings - Fork 0
/
20_random_password.sh
29 lines (27 loc) · 1004 Bytes
/
20_random_password.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<<Documentation
NAME : S.Jagajeevan
DATE : 15.05.2021
DESCRIPTION : Script for generating random 8-caracter passwords including alpha numeric characters
INPUT : ./20_random_password.sh
Enter how many times you want to print random password 3
OUTPUT : x9yWc`S,
tu;^fS3`
zV;q~wM)
Documentation
#!/bin/bash
#Script for generating random 8-caracter passwords including alpha numeric characters
read -p " Enter how many times you want to print random password " n
if [ $n -lt 1 ]
then
echo " Please enter positive integers"
exit
fi
for i in `seq $n`
do
cat /dev/urandom | tr -cd [:print:] | head -c 8
echo
# from the /dev/urandom file we take the password
# -cd complementing the non readable files to readable and to delete the spaces from print
# [:print;] is t print all characters including spaces
# from head -c 8 the first 8 charcters (bytes) is to be printed (Each time they generate different characters)
done