You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Joachim Ansorg edited this page Nov 12, 2021
·
2 revisions
Use false instead of empty [/[[ conditionals.
Problematic code:
if [ ]
thenecho"Temporarily disabled"fi
Correct code:
iffalsethenecho"Temporarily disabled"fi
Rationale:
[ ] is a somewhat obscure way of expressing falsehood, and the behavior is likely intended to allow the incorrectly quoted command [ $var ] to still work when the variable is unset.
POSIX has a more descriptive command false for this.
Exceptions:
None. This is a stylistic suggestion, and has no effect on how the script works.