Non-trivial scripts have to be specifically written to run with set -e
.
gvm-init.sh
has not been written to allow this, and breaks when it's enabled.
Consider for example this section:
GVM_DETECT_HTML="$(echo "$GVM_RESPONSE" | tr '[:upper:]' '[:lower:]' | grep 'html')"
if [[ -n "$GVM_DETECT_HTML" ]]; then
...
This isn't good or idiomatic bash code in anyway, but it works well enough by itself. It finds lines containing "html", and sticks them in the variable. Then it checks whether the variable is empty or not.
However, when you enable set -e
, the script exits if the variable will be empty, before the script has a chance to look at it and account for that.
There's not really anything you can do about this, short of rewriting gvm-init.sh
or set +e
before you run any affected code.