test(1): quote closing bracket in error message

If test is called as [ and one forgets to close the bracket, the error
message is currently
[: missing ]

To make it obvious that this is not something printed in brackets,
quote the closing bracket in the message, which is what everybody else
is doing:
[: missing ']'

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1346
This commit is contained in:
Daniel Tameling 2024-07-24 13:56:16 +02:00 committed by Warner Losh
parent 1d551845f3
commit 5f659bb0b6

View File

@ -198,7 +198,7 @@ main(int argc, char **argv)
p++;
if (strcmp(p, "[") == 0) {
if (strcmp(argv[--argc], "]") != 0)
error("missing ]");
error("missing ']'");
argv[argc] = NULL;
}