I have some command in .profile
that can fail or succeed, I don’t care about the error, if it failed just ignore it. However, even if I put it in an if block and redirect its output to /dev/null
, there’s still an error shown up. I also tried wrap around that command with set +e
and set -e
but doesn’t work.
I don’t want to remove the command.
if command > /dev/null 2>/dev/null; then
:
else
:
fi