It's hopeless because POSIX requires both since Issue 6 (2001).
Both always worked on OpenBSD, no matter which base system shell was used.
According to research done by jsg@, it seems likely that actually,
"test -L" has precedence over "test -h" by about one year:
v8 (Feb 1985) had -L, SunOS 3.0 (Feb 1986) had -h; but SVR4 (1989)
already had both, so we are talking about 35 years of petrification.
More details: https://marc.info/?l=openbsd-bugs&m=
171867441927989
Resolving a question raised by Tim dot theCHASEs dot com on bugs@.
OK deraadt@ millert@ jsg@ jmc@ and also works for Tim Chase.
-.\" $OpenBSD: test.1,v 1.34 2023/06/10 07:19:39 op Exp $
+.\" $OpenBSD: test.1,v 1.35 2024/06/18 16:41:39 schwarze Exp $
.\" $NetBSD: test.1,v 1.6 1995/03/21 07:04:03 cgd Exp $
.\"
.\" Copyright (c) 1991, 1993
.\"
.\" @(#)test.1 8.1 (Berkeley) 5/31/93
.\"
-.Dd $Mdocdate: June 10 2023 $
+.Dd $Mdocdate: June 18 2024 $
.Dt TEST 1
.Os
.Sh NAME
True if
.Ar file
exists and is a symbolic link.
+Identical to
+.Fl L .
.It Fl k Ar file
True if
.Ar file
True if
.Ar file
exists and is a symbolic link.
-This operator is for compatibility purposes.
-Do not rely on its existence;
-use
-.Fl h
-instead.
+Identical to
+.Fl h .
.It Fl n Ar string
True if the length of
.Ar string
-/* $OpenBSD: test.c,v 1.20 2022/10/11 13:40:38 jsg Exp $ */
+/* $OpenBSD: test.c,v 1.21 2024/06/18 16:41:39 schwarze Exp $ */
/* $NetBSD: test.c,v 1.15 1995/03/21 07:04:06 cgd Exp $ */
/*
{"-t", FILTT, UNOP},
{"-z", STREZ, UNOP},
{"-n", STRNZ, UNOP},
- {"-h", FILSYM, UNOP}, /* for backwards compat */
+ {"-h", FILSYM, UNOP},
{"-O", FILUID, UNOP},
{"-G", FILGID, UNOP},
{"-L", FILSYM, UNOP},