The following code exits with a unbound variable error. How to fix this, while still using the set -o nounset option?
set -o
#!/bin/bash set -o nounse
You can use
if [[ ${WHATEVER:+$WHATEVER} ]]; then
but
if [[ "${WHATEVER:+isset}" == "isset" ]]; then
might be more readable.