Problem with mutt version.sh script

Vincent Lefevre vincent at vinc17.org
Mon Apr 23 11:37:31 UTC 2018


On 2018-04-20 17:01:50 -0500, Derek Martin wrote:
> On Thu, Apr 19, 2018 at 08:24:43PM +0200, Vincent Lefevre wrote:
> > On 2018-04-17 14:28:17 -0500, Derek Martin wrote:
> > > One wonders what systems these are, and whether this is even worth
> > > considering.  If it is, I believe Bourne shell allows compound tests
> > > like the following: 
> > > 
> > >   [ -f $file -o -d $file ]
> > 
> > AFAIK, -o is not portable and has been marked obsolescent.
> > You should write:
> > 
> >   [ -f "$file" ] || [ -d "$file" ]
> 
> Sure, I have no issue with writing it that way... it's probably
> slighly less efficient, but whether it is or isn't is not interesting
> here.
> 
> I have doubts about the "not portable" comment though...  AFAICT it's
> currently supported by Bourne, Korn, Bash, and all POSIX-compliant
> shells.

For POSIX, this is an XSI extension. Thus not all POSIX shells might
support it. And in practice, its use in the general case is error
prone and the behavior depends on the shell. So, the best thing is
probably to have it removed in the future.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the Mutt-dev mailing list