GREEN='\033[0;32m'
NC='\033[0m' # No Color
rimip2=$(echo -e "${GREEN}222b:b33c:3401:2341:88c2:85d7:5cf6:6a01${NC}" | grep "222b:b33c:3401:2341:88c2:85d7:5cf6:6a01")
if [[ "${rimip2}" == "222b:b33c:3401:2341:88c2:85d7:5cf6:6a01" ]]; then
echo "#### Same"
else
echo "#### Different"
fi
This code always print "#### Different" although the visible displayed value of echo ${rimip2} is 222b:b33c:3401:2341:88c2:85d7:5cf6:6a01
If I remove ${GREEN} and ${NC}, then "#### Same" is displayed.
This is a simplified portion of a complex code. So my aim is to maintain printing in GREEN color, and then grepping that line which I will use for ssh. But now I cannot use it for SSH until it is equal to the string value "222b:b33c:3401:2341:88c2:85d7:5cf6:6a01"
How can remove the Green encoding part after grepping the line?