diff options
-rwxr-xr-x | bin/bin/makepass | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/bin/makepass b/bin/bin/makepass index 4aa05cd..596c6e5 100755 --- a/bin/bin/makepass +++ b/bin/bin/makepass @@ -20,6 +20,8 @@ function makepass { local l=$1 local words + local first + local last MAKEPASS_WORDLIST=${MAKEPASS_WORDLIST:-/usr/share/dict/words} # if $l is not a number, then exit [[ ! $l =~ ^[0-9]+$ ]] && [[ ! "$l" == "" ]] && echo "not a number" && return 1 @@ -34,7 +36,10 @@ function makepass { echo "Passwords with special characters:" for i in {1..6}; do [ "$1" = "" ] && l=$(shuf -i 16-64 -n 1) - < /dev/urandom tr -dc '!#$%&/()=?+-_,.;:<>[]{}|\@*^A-Z-a-z-0-9' | head -c${1:-$l};echo; + first=$(< /dev/urandom tr -dc A-Za-z | head -c 1) + words=$(< /dev/urandom tr -dc '!#$%&/()=?+-_,.;:<>[]{}|\@*^A-Z-a-z-0-9' | head -c${1:-$l} | cut -c 3-) + last=$(< /dev/urandom tr -dc A-Za-z | head -c 1) + echo "${first}${words}${last}" done | column if [ -r "${MAKEPASS_WORDLIST}" ]; then |