From: Georg Pfuetzenreuter Date: Mon, 08 Jul 2024 10:35:49 GMT Subject: Re: [PATCH 8/8] check-whitespace: detect if no base_commit is provided Message-ID: In-Reply-To: On 7/8/24 12:18 PM, Chris Torek wrote: > The `test` command has AND and OR operators of its own, > which give `-a` (AND) higher precedence than `-o` (OR). In > addition, `$#` can only expand to an integer value, so quotes > are not required, and the whole thing can be written as: > > if test $# -ne 1 -a $# -ne 3 -o -z "$1" > > (which is what I would do myself, unless I wanted a separate > error message for an empty "$1"). It's fine as is though. Hi, https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html states "The XSI extensions specifying the -a and -o binary primaries and the '(' and ')' operators have been marked obsolescent." suggesting "&&" being preferred over "-a". > Chris >