Using bash 4.2, I have an associative array.
I want to check if the value at a key contains or not a string. To achieve this, based on this topic, i do the following:
ERRORS[TEST]="TEST"
if [[ ! ERRORS[TEST] =~ "TEST" ]]; then
echo "failed"
else
echo "succeed"
fi
This should echo failed, but it echoes succeed.
What I am missing or not understanding in this behavior ? If my method is wrong, how can I achieve this ?