Project

General

Profile

Actions

Bug #586

closed

sed -i should take an "optional" argument

Added by Garrett D'Amore over 11 years ago. Updated over 10 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
cmd - userland programs
Start date:
2010-12-29
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

As much as I hate this....

GNU sed allows -i to take an argument, but does not require it. We should observe the same GNU behavior for increased compatibility.

Note that there is no elegant way (that I could discover) to properly support this with getopt... the optional argument should be optional only for -i, and should be treated as an argument to -i only when used without intervening spaces. This is apparently POSIX compliant, although it violates the CLIP standard.

I'd recommend making a minor enhancement to getopt to support this, or perhaps extending getopt_long.


Related issues

Related to illumos gate - Bug #1815: sed -i "" no longer worksNewJoshua M. Clulow2011-11-25

Actions
Has duplicate illumos gate - Bug #673: sed -i argument temp file should be optionalClosed2011-01-27

Actions
Actions

Also available in: Atom PDF