From 1f45e6759635b441ff413dee402392a5e58c28c5 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Tue, 20 Dec 2022 06:23:18 +0100 Subject: forgot to change an instance of head -c also, RANDOM is reserved in ksh. Use var with other name. --- bin/bin/makepass.sh | 8 ++++---- bin/bin/makepass.zsh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'bin') 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:" -- cgit v1.2.3