I want to run a command inside my bash script with or without a -v flag depending on if the environment variable $VERBOSE is defined. Something like this:
-v
For readability, consider using an array to store the arguments.
args=( -m "$MONGO_HOST" -t "$NEO_URI" -stdout ) if [[ -v VERBOSE ]]; then args+=(-v) fi /usr/local/bin/mongo-connector "${args[@]}"