I have the following snippet, where the function test echoes false. I use the echoed value in an if statement with shell substitution:
#!/usr/bin/env bash
test () {
echo "false"
}
if [[ "$(test)" -eq "true" ]]
then
echo hello world
fi
I would expect to above to not print hello world, because I assume this would end up saying [[ "false" -eq "true" ]].
However when I run the script it echoes hello world.