To match spaces, use quotes:
Code:
if [[ "aa" == " aa" ]]; then
echo match
else
echo no match
fi
Should output "no match" because of the leading space on the second operand. You can still use variables, e.g.
Code:
v=" aa"
if [[ "$v" == " aa" ]]; then
echo match
else
echo no match
fi
Should output "match".