bug-sed
[Top][All Lists]
Advanced

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

bug#20796: [PATCH] Document behavior of sed -i -


From: Jim Meyering
Subject: bug#20796: [PATCH] Document behavior of sed -i -
Date: Mon, 22 Jun 2015 07:06:46 -0700

On Mon, Jun 22, 2015 at 6:43 AM, Stanislav Brabec <address@hidden> wrote:
> Jim Meyering wrote:
>
>> However, rather than documenting this surprising behavior,
>> I propose to remove the anomaly altogether with the attached patch.
>> Does anyone see a reason to retain the behavior of treating "-"
>> like "./-"?
>>
> The reason is simple: "sed -i" makes no sense on stdin, so the special
> handling od "-" is disabled.
>
> We can either ignore "-i" for stdin, or report error:
> "Editing standard input in place is an undefined operation."

Ignoring a fundamental user-specified option like -i is not an option,
so I chose the latter: to make this nonsensical usage evoke
a diagnostic:

  $ sed -i s/a/b/ -
  sed: couldn't edit -: is a terminal

I chose to use the same diagnostic that was already printed for
a case like "sed -i s/a/b/ /dev/stdin".  It feels slightly better to
include the name of the offending device.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]