[illumos-Developer] sed -i behavior - question

Garrett D'Amore garrett at damore.org
Tue Dec 21 06:55:14 PST 2010


On 12/21/10 02:51 AM, Joerg Schilling wrote:
> "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.
>    

I'd argue that optional option arguments are inherently unclean, but I 
agree with you in this regard.  If you have to live with them, then this 
is probably the best compromise.

In this case, I'm not yet convinced we have to follow the GNU example.  
Certainly FreeBSD does not.

   - Garrett




More information about the Developer mailing list