I'm not sure what scenario you're imagining with your other concern. This does what you would expect:
set -o errexit if [ -f somefile ] then echo "File exists." else echo "File does not exist." fi
I'm not sure what scenario you're imagining with your other concern. This does what you would expect: