One more note: This breaks in the (exotic, but currently supported) case that a root user executes the script (= and doesn't need sudo). Use `$SUDO_CMD` instead of sudo for that.