Variable USE_TLS is to be unset, null, or empty when TLS is not to be used, but set to 1 when TLS must be enforced. I require it to be enforced by default (i.e., set), but not if I specify another variable do_not_use_tls be set to 1.
# this assigns null or empty
USE_TLS=${do_not_use_tls:-""}
# this assigns empty or null
USE_TLS=${do_not_use_tls:+""}
Is there a substitution which will set USE_TLS when do_not_use_tls is null or unset, but not assign it a value otherwise? I was trying the following, but these do not work:
USE_TLS=${do_not_use_tls:+${do_not_use_tls:-""}}
USE_TLS=${do_not_use_tls:-${do_not_use_tls:+null}}
do_not_use_tls=1thenUSE_TLSshould be set tofoo?[ "${do_not_use_tls:-0}" -eq 1 ] && unset USE_TLS?unset.