3 ms·
You've got exactly same problem of undefined vs empty in sh (-n not being exact inverse of -z vs string comparision with != "", different behavior if -u is set,
by Too 4y ago
You've got exactly same problem of undefined vs empty in sh (-n not being exact inverse of -z vs string comparision with != "", different behavior if -u is set, etc). Just check the stackoverflow answers on how to test if a bash string is empty or undefined and there isn't even consensus on what is the best way to do it.
Mypy has had strict Optional checking on as default since 2018, almost entirely eliminating any None-related errors, meaning it is actually stricter and safer than Java or other traditionally considered static languages in that regard, (bar any dynamic misuse in deserialization boundaries). Assuming you use mypy of course, but that's a given today imo, like using shellcheck is for sh.