NetBSD-Bugs archive

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

Re: bin/57997: sh(1) allows an empty list in if statements



The following reply was made to PR bin/57997; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: bin/57997: sh(1) allows an empty list in if statements
Date: Tue, 05 Mar 2024 04:32:59 +0700

     Date:        Mon,  4 Mar 2024 18:30:01 +0000 (UTC)
     From:        rvp%SDF.ORG@localhost
     Message-ID:  <20240304183001.9C7081A923B%mollari.NetBSD.org@localhost>
 
   | Apparently, NetBSD's sh(1) doesn't need a `list' after `then' in `if'
   | statements:
 
 It is ancient histiric ash shell behaviour to allow empty lists
 in places where the standard requires something - the FreeBSD
 shell (or the slightly old version I have anyway) is similar,
 though it looks like dash has been changed.
 
 There used to be a lot of that, some of it has been altered,
 others left to allow an empty list.
 
 This is really OK, it is just an extension to the standardm any
 script written to standard shell syntax will never observe it,
 scripts written for the NetBSD shell that want to take advantage
 of the relaxed syntax can do so.   There are very few shells (I'd
 expect probably zero) which have no extensions to the standard
 permitted.
 
 I'm not inclined to change this unless someone can provide a
 compelling reason why it needs to be changed - if I did change it,
 it would likely only enforce the requirement for something to exist
 there in posix mode.
 
 kre
 


Home | Main Index | Thread Index | Old Index