From 84d23e60d1268edc155cf9b1f2a4515e8ab47efb Mon Sep 17 00:00:00 2001 From: Badlop Date: Thu, 23 Dec 2021 11:33:17 +0100 Subject: [PATCH] In POSIX sh, RANDOM is undefined: use always the other method --- tools/captcha.sh | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/tools/captcha.sh b/tools/captcha.sh index a619626cf..7885858a2 100755 --- a/tools/captcha.sh +++ b/tools/captcha.sh @@ -15,19 +15,12 @@ INPUT=$1 -if test -n ${BASH_VERSION:-''} ; then - get_random () - { - R=$RANDOM - } -else - for n in $(od -A n -t u2 -N 48 /dev/urandom); do RL="$RL$n "; done - get_random () - { - R=${RL%% *} - RL=${RL#* } - } -fi +for n in $(od -A n -t u2 -N 48 /dev/urandom); do RL="$RL$n "; done +get_random () +{ + R=${RL%% *} + RL=${RL#* } +} get_random WAVE1_AMPLITUDE=$((2 + R % 5))