I have a bash script that I want to globally enable set -e.
But rather than disable it and reenable it all the time, I'm wondering if there is a way of selectively disabling error handling just sometimes. For example, commands run from systemd can be preceeded by a minus to ignore errors. Does bash has an equivalent?
e.g.
#!/bin/bash
set -e
WAN_IF=eth2
# Ignore error on next line
tc qdisc del dev ${WAN_IF} root
# I want errors to stop the script on this line
tc qdisc add dev ${WAN_IF} root handle 1: htb default 10
...
etc
Because of the need to enable/disable a lot I don't want to have to keep doing the following:
set +e
tc qdisc del dev ${WAN_IF} root
# I want errors to stop the script on this line
set -e
tc qdisc add dev ${WAN_IF} root handle 1: htb default 10
...