From 6ef757bc8ba947e47a5ae6a67c41363d2d301057 Mon Sep 17 00:00:00 2001 From: boyska Date: Fri, 22 Sep 2023 02:36:03 +0200 Subject: [PATCH] shellcheck --- banana.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/banana.sh b/banana.sh index ddcacca..e90fe52 100755 --- a/banana.sh +++ b/banana.sh @@ -10,16 +10,16 @@ v=$num st= length=0 -idx=$((($numalpha - 1) % $numalpha)) -while !( [ $v -eq 0 ] && [ $idx -eq $((($numalpha - 1) % $numalpha)) ] && [ $length -ge $minlength ] ) +idx=$(((numalpha - 1) % numalpha)) +while ! { [ "$v" -eq 0 ] && [ $idx -eq $(((numalpha - 1) % numalpha)) ] && [ $length -ge $minlength ] ; } do al=${alphabets[idx]} - r=$(($v % ${#al})) - v=$(($v / ${#al})) + r=$((v % ${#al})) + v=$((v / ${#al})) st="${al:$r:1}$st" - idx=$((($idx + $numalpha - 1) % $numalpha)) - length=$(($length + 1)) + idx=$(((idx + numalpha - 1) % numalpha)) + length=$((length + 1)) done -echo $st +echo "$st"