I am trying to run the test command from a string. The string contains the expression.
TEST="! -e ~/bin/xyz"
if [ `echo "$TEST"` ]; then
echo running "$TEST";
fi
However, the above if condition does evaluate to true but if I plug in the command directly (as below), it evaluates to false.
if [ ! -e ~/bin/xyz ]; then
echo running;
fi
The second snippet's behavior is correct. Why is there is a difference and also how I can correct the first snippet to give me the right result?