fix display of longer or shorter lover names

This commit is contained in:
missytake 2024-06-08 17:52:09 +02:00
parent eb05660783
commit de26e04632
Signed by: missytake
GPG key ID: 04CC6658320518DF

View file

@ -1,9 +1,8 @@
read -p "Enter the lovers name: " lover
echo " Does '$lover' love you? "
number=(8 + $RANDOM%15)
repeats=0
printf -v loverspaces '%*s' "$((70-${#lover}))"
while [[ $repeats < $number ]]
do
@ -14,9 +13,11 @@ do
echo "QQQQQQQQQQQQQQQQ QQQQQQQQQQQQQQQ"
if [ $(($repeats%2)) == 0 ]
then
echo "QQQQQQQQQQQQQQQQ $lover loves me QQQQQQQQQQQQQQQ"
printf "QQQQQQQQQQQQQQQQ $lover loves me "
printf '%s QQQQQQQQQQQQQQQ\n' "${loverspaces// / }"
else
echo "QQQQQQQQQQQQQQQQ $lover loves me not QQQQQQQQQQQQQQQ"
printf "QQQQQQQQQQQQQQQQ $lover loves me not "
printf '%s QQQQQQQQQQQQQQQ\n' "${loverspaces// / }"
fi
echo "QQQQQQQQQQQQQQQQ QQQQQQQQQQQQQQQ"
echo "QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"
@ -39,9 +40,11 @@ do
echo "QQQQQQQQQQQQQQQQ QQQQQQQQQQQQQQQ"
if [ $(($repeats%2)) == 0 ]
then
echo "QQQQQQQQQQQQQQQQ $lover loves me QQQQQQQQQQQQQQQ"
printf "QQQQQQQQQQQQQQQQ $lover loves me "
printf '%s QQQQQQQQQQQQQQQ\n' "${loverspaces// / }"
else
echo "QQQQQQQQQQQQQQQQ $lover loves me not QQQQQQQQQQQQQQQ"
printf "QQQQQQQQQQQQQQQQ $lover loves me not "
printf '%s QQQQQQQQQQQQQQQ\n' "${loverspaces// / }"
fi
echo "QQQQQQQQQQQQQQQQ QQQQQQQQQQQQQQQ"
echo "QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ"