Thread (71 messages) 71 messages, 6 authors, 2024-07-24

Re: [PATCH 8/8] check-whitespace: detect if no base_commit is provided

From: Georg Pfuetzenreuter <hidden>
Date: 2024-07-08 10:44:43


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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help