Jason McIntyre writes:
> On Sun, Jun 16, 2024 at 03:05:24AM -0300, Crystal Kolipe wrote:
> > On Sat, Jun 15, 2024 at 06:45:21PM -0500, Tim Chase wrote:
> > > According to
> > > 
> > >   $ man [ | grep -A4 -e "-L.*f"
> > >      -L file
> > >         True if file exists and is a symbolic link.  This operator is for
> > >         compatibility purposes.  Do not rely on its existence; use -h
> > >         instead.
> > 
> > There is definitely a discrepency between manual and source, because the
> > source contains a comment saying that -h is for backwards compatibility:
> > 
> >     {"-h",  FILSYM, UNOP},          /* for backwards compat */
> > 
> > and that comment has been there since the code was imported to NetBSD in
> > revision 1.13 in 1994.

When test's -h option was first added to OpenBSD's tree in 1995
that was the option marked as existing only for compatibility
purposes, this was switched in 2003:

    Changes since 1.16: +6 -6 lines

    encourage people to use -h rather than -L;
    document -L as compatibility option;
    slight sync with NetBSD description;

    ok otto@ millert@

I'd guess there was some discussion about it but I can't be bothered
to look for it.

The ksh manpage lists both -h and -L without prioritising either.

I think it's safe to say we can rely on both flags existing now in
all variations of the tool. Supporting both is what? Half a dozen
opcodes?

[[ is more expressive anyway.

Matthew

ps. While we're on the subject, perl calls its (only) variant -l. ]]

--- /usr/src/bin/test/test.1    Sat Aug 19 05:23:44 2023
+++ /tmp/test.1 Sun Jun 16 15:00:02 2024
@@ -118,11 +118,6 @@
 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.
 .It Fl n Ar string
 True if the length of
 .Ar string

Reply via email to