Fix password regex

This commit is contained in:
Kevin Cotugno 2017-12-15 14:12:37 -08:00
parent 7c8f80ab2e
commit 5cbc4e8661

View File

@ -30,8 +30,8 @@ function passgen () {
local len="$1"
local lower="$2"
echo "$len" | grep -q '^[0-9]+$'
if (( ! $? )); then
echo "$len" | grep -E '^[0-9]+$'
if (( $? )); then
len=32
fi
@ -40,7 +40,7 @@ function passgen () {
local tr2="[:lower:]"
fi
cat /dev/urandom | base64 | head -c $len | tr -d "\n" | \
cat /dev/urandom | base64 | head -c "$len" | tr -d "\n" | \
tr "$tr1" "$tr2" && echo
}