Yes! But -u is for undefined variables. It won’t stop a defined variable with an empty value. E.g foo="".
Also ? and :? have the advantage of telling you right then and there where the variable use is that it must be defined or not empty… having to trek back to (likely) the top of the script to check is easily forgotten.
Yes! But
-u
is for undefined variables. It won’t stop a defined variable with an empty value. E.gfoo=""
.Also
?
and:?
have the advantage of telling you right then and there where the variable use is that it must be defined or not empty… having to trek back to (likely) the top of the script to check is easily forgotten.