This is my first time attempting to write a long bash script to manage a server I run, and when using "set -ex" the script exits when umount fails. I thought my if statement would catch it but the script exits before echo is fired.
What am I overlooking here?
umount $MOUNTPATH if [[ $? -ne 0 ]]; then /bin/echo "Failed to unmount! Already unmounted?" fi