help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Manual descriptions for -a file and -e file


From: Andreas Kusalananda Kähäri
Subject: Re: Manual descriptions for -a file and -e file
Date: Mon, 27 Mar 2023 09:44:00 +0200

On Mon, Mar 27, 2023 at 09:35:32AM +0200, Emanuele Torre wrote:
> On Mon, Mar 27, 2023 at 09:20:27AM +0200, Andreas Kusalananda Kähäri wrote:
> > Oh, about -L and -h: The description in the POSIX standad for these
> > two are identical, without pointing out that they are identical.  So
> > there is a precedence there.
> > 
> > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
> 
> Thankfully, FreeBSD avoids confusions caused by the existence of those
> two identical primaries by claiming that -h is not guaranteed to be
> supported and that -L should always be used instead:
> 
>     -h file  True if file exists and is a symbolic link.  This operator
>              is retained for compatibility with previous versions of
>              this program.  Do not rely on its existence; use -L
>              instead.
> 
>     -L file  True if file exists and is a symbolic link.
> 
> https://www.freebsd.org/cgi/man.cgi?test
> 
> OpenBSD also avoids confusions by claiming that -L is not guaranteed to
> be supported and that -h should always be used instead:   :D
> 
>     -h file  True if file exists and is a symbolic link.
> 
>     -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.
> 
> https://man.openbsd.org/test
> 
>  emanuele6

... which is a bit silly since both are clearly supported by POSIX and
neither is marked as deprecated.  Removing -L would therefore break
alignment with POSIX.

The case for marking the unary -a test in the bash manual would
be different if bash decided to deprecate -a in some future
version.  Deprecating -a and later removing it would not break POSIX
compatibility, but would potentially break really old scripts originally
written for the Korn shell.

-- 
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden

.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]