forked from koalaman/shellcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
SC2166
Vidar Holen edited this page Oct 4, 2015
·
2 revisions
And likewise, prefer [ p ] || [ q ]
over [ p -o q ]
.
[ "$1" = "test" -a -z "$2" ]
[ "$1" = "test" ] && [ -z "$2" ]
-a
and -o
to mean AND and OR in a [ .. ]
test expression is not well defined. They are obsolescent extensions in POSIX and their behavior is almost always undefined.
Using multiple [ .. ]
expressions with shell AND/OR operators &&
and ||
is well defined and therefore preferred (but note that they have equal precedence, while -a
/-o
is unspecified but often implemented as -a
having higher precedence).
None.