I have this bash statement:
if ls > /dev/null 2>&1 -a ls > /dev/null 2>&1; then
echo "true";
else
echo "false";
fi
Which gives me "false". But I know ls will always return 0 (i.e. true). I had thought that -a was an AND statement.
When I change this to:
if ls > /dev/null 2>&1 && ls > /dev/null 2>&1; then
echo "true";
else
echo "false";
fi
It works. What's going on differently here? Is -a not an AND operator?