From 5cbc4e8661db624c5b047cd27123a17b657d7a33 Mon Sep 17 00:00:00 2001 From: Kevin Cotugno Date: Fri, 15 Dec 2017 14:12:37 -0800 Subject: [PATCH] Fix password regex --- profile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/profile b/profile index 26d3eec..991ede0 100644 --- a/profile +++ b/profile @@ -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 }