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 }