diff options
author | Dennis Eriksen <d@ennis.no> | 2022-12-20 06:23:18 +0100 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2022-12-20 06:23:18 +0100 |
commit | 1f45e6759635b441ff413dee402392a5e58c28c5 (patch) | |
tree | e5759b18978cadc1774136a081804c610ffdf6ba /bin | |
parent | head -c is not portable.. tail -c is. and head -n (diff) | |
download | makepass-1f45e6759635b441ff413dee402392a5e58c28c5.tar.gz |
forgot to change an instance of head -c
also, RANDOM is reserved in ksh. Use var with other name.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/bin/makepass.sh | 8 | ||||
-rwxr-xr-x | bin/bin/makepass.zsh | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/bin/bin/makepass.sh b/bin/bin/makepass.sh index 6b80420..502867a 100755 --- a/bin/bin/makepass.sh +++ b/bin/bin/makepass.sh @@ -24,11 +24,11 @@ if [ ! -z "$1" ] && [ ! ${1:-0} -gt 0 ]; then printf '%s\n' 'not a number above # get random number _RANDOM() { - RANDOM=0 - while [ ! "$RANDOM" = "${RANDOM#0}" ]; do - RANDOM=$(head -n100 /dev/urandom | tr -cd "[:digit:]" | tail -c 8) + N=0 + while [ ! "$N" = "${N#0}" ]; do + N=$(head -n100 /dev/urandom | tr -cd "[:digit:]" | tail -c 8) done - printf '%s\n' "$RANDOM" + printf '%s\n' "$N" return 0 } diff --git a/bin/bin/makepass.zsh b/bin/bin/makepass.zsh index bba6097..e5dd8bd 100755 --- a/bin/bin/makepass.zsh +++ b/bin/bin/makepass.zsh @@ -59,7 +59,7 @@ function makepass() { setopt local_options local -i len=$1 MAKEPASS_WORDLIST=${MAKEPASS_WORDLIST:-/usr/share/dict/words} - RANDOM=$(< /dev/urandom tr -cd '[:digit:]' | head -c 10) # seed RANDOM + RANDOM=$(head -n10 /dev/urandom | tr -cd '[:digit:]' | tail -c 10) # seed RANDOM # Normal passwords print "Normal passwords:" |