Comparsion operator exercise, Bash scripting module

Question → Create an “If-Else” condition in the “For”-Loop that checks if the variable named “var” contains the contents of the variable named “value”. Additionally, the variable “var” must contain more than 113,450 characters. If these conditions are met, the script must then print the last 20 characters of the variable “var”. Submit these last 20 characters as the answer.

Code given →

#!/bin/bash

var="8dm7KsjU28B7v621Jls"
value="ERmFRMVZ0U2paTlJYTkxDZz09Cg"

for i in {1..40}
do
        var=$(echo $var | base64)
		
		#<---- If condition here:
done

My code →

#!/bin/bash

var="8dm7KsjU28B7v621Jls"
value="ERmFRMVZ0U2paTlJYTkxDZz09Cg"

for i in {1..40}
do
    var=$(echo $var | base64)

    # If-Else condition here:
    if [ ${#var} -gt 113450 ] && [[ $var == *$value* ]]; then
        last_20_chars="${var: -20}"
        echo "Condition met at iteration $i"
        echo "Last 20 characters of 'var': $last_20_chars"
        break   # You can break out of the loop once the condition is met
    else
        echo "Condition not met at iteration $i"
    fi
done

getting the answer as → U2paTlJYTkxDZz09Cg==
still getting incorrect answer.

You were almost there. If you weren’t able to figure it out, give another look at the hint. Echo the hint with the var.

Your question helped me think on how to do mine, but with the “hint”.