CIDR=$(echo "$DESCRIBE_VPC" | $JQ -r '.Vpcs[0].CidrBlock')
DEN_PARAM=$(aws ssm get-parameters --names "$DEN" --region $REGION)
GET_PARAM_VALUE=$(echo $PARAM | jq -r '.Parameters[].Value' | tr '[:upper:]' '[:lower:]')
DS_HOST=$(nslookup dsaws.com)
DS_STATUS=$?
if [ "$CIDR" == *"100."* ] && [ "$DS_STATUS" == 0 ] ## Ex: 100.1.172.1 /172.1.100.1
then
retrieveAccInfo
elif [ "$CIDR" == *"172."* ] && [ "$DS_STATUS" != 0 ]
then
retrieveAccInfo
fi
In Above example, I am trying to match substring "100." and "172." with a retrieved IP address. The above condition matches but if I get an IP: 172.1.1.100 that matches both conditions. What if I want IP address that exactly starts with 100 and 172 to match with the IPs, but not anywhere else in the string(IP).