I checked a script of mine with checkbashisms and I got the following warnings:
possible bashism in check_ssl_cert line 821 (test -a/-o):
if [ -n "${ALTNAMES}" -a -n "${COMMON_NAME}" ] ; then
In section 4.62.4 of the POSIX specs I find
primary -a primary Performs a binary and of the results of primary and primary. The -a operator has precedence over the -o operator.
Why are -a
and -o
considered non-portable?
-a
and-o
– Stéphane Chazelas Dec 07 '12 at 08:27[ "x$ALTNAMES" != x -a "x$COMMON_NAME" != x ]
(still unspecified as per POSIX but portable and reliable), or[ "${ALTNAMES:+x}${COMMON_NAME:+x}" = xx ]
– Stéphane Chazelas Dec 07 '12 at 10:40