[illumos-Developer] sed -i behavior - question

Joerg Schilling Joerg.Schilling at fokus.fraunhofer.de
Tue Dec 21 02:51:19 PST 2010


"Garrett D'Amore" <garrett at damore.org> wrote:

> If you don't use sed, or care about it, delete this message.
>
> The question centers around "-i" in our implementation of sed.  While we 
> have a "-i" flag, it *assumes* a suffix (extension) will follow it.  The 
> next argument is taken as such unconditionally.  (E.g. it uses i: in 
> getopt string.)
>
> Now GNU sed has the SUFFIX as optional.  It looks at the next string and 
> tries to make a decision based on whether the next option starts with a 
> "-" or not.   This feels far "tar-ish", unfortunately, and violates the 
> CLIP (and I think, the POSIX rules too.)

The only clean way to implement optional option-Arguments is to require the 
arguments to directly (without space) follow the option.

Other gimmicks (like the one mentioned above, or the arg reordering done by GNU 
getopt) are a violation of the POSIX CLI base guidelines.

Jörg

-- 
 EMail:joerg at schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       js at cs.tu-berlin.de                (uni)  
       joerg.schilling at fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily



More information about the Developer mailing list