Skip to content

Commit 0eb4410

Browse files
authored
Update main.sh
1 parent 06a43ca commit 0eb4410

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

func/main.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,14 @@ get_user_owner() {
165165
# Random password generator
166166
generate_password() {
167167
matrix=$1
168-
lenght=$2
168+
length=$2
169169
if [ -z "$matrix" ]; then
170-
matrix=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
170+
matrix=[:alnum:]
171171
fi
172-
if [ -z "$lenght" ]; then
173-
lenght=10
172+
if [ -z "$length" ]; then
173+
length=10
174174
fi
175-
i=1
176-
while [ $i -le $lenght ]; do
177-
pass="$pass${matrix:$(($RANDOM%${#matrix})):1}"
178-
((i++))
179-
done
180-
echo "$pass"
175+
cat /dev/urandom | tr -dc $matrix | head -c$lenght
181176
}
182177

183178
# Package existence check

0 commit comments

Comments
 (0)