I have tried all sorts of ways to redirect both stdout
and stderr
to /dev/null
without any success. I have almost my entire life run bash which I've never had this issue with, but for once in BSD I'm stuck with /bin/sh
.
What I've tried:
if ls ./python* 2> /dev/null; then
echo found Python
fi
... which works; if Python is not present it will mute the error messages from ls.
However, if python.tgz
is present, a line with be outputted which looks like this:
# ./test.sh
./python-2.7.3p1.tgz
I've tried:
if ls ./python* &> /dev/null; then
echo found Python
fi
and
if ls ./python* 2>1 > /dev/null; then
echo found Python
fi
and
if ls ./python* > /dev/null; then
echo found Python
fi
Nothing really works. I can only redirect one of the outputs, not both at the same time.