I'm using the man page for "test". I understood everything except for the following 2 lines. Can someone give me an example of how to actually use this because thus far I've been using 1 dimensional tests (i.e. is x = y kind of thing in my tests), so comparing expressions doesn't make too much sense in my head. I think if someone can show me an example or use case I'd get it.
EXPRESSION1 -a EXPRESSION2
both EXPRESSION1 and EXPRESSION2 are true
EXPRESSION1 -o EXPRESSION2
either EXPRESSION1 or EXPRESSION2 is true
bash
and used the phrase "man page fortest
", so maybe you are not aware of the following:test
is a builtin in Bash andhelp test
in Bash describes it, butman test
describes a standalone executable. The builtin and the executable may differ in what they support. Depending on what syntax you use and where (test
,/usr/bin/test
,find … -exec test …
,sudo test …
, …), you use one or the other. I don't think the answer to your question depends on whattest
you use, but in general it's good to knowman test
does not describe the builtin. – Kamil Maciorowski Dec 11 '22 at 19:55