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

Re: sed -i turns link into file



On 2008-01-18 02:54:12 +0100, Александър Л. Димитров wrote:
> I don't think it's a bug, but a feature.

It's at least a documentation bug. The sed(1) man page says:

       -i[SUFFIX], --in-place[=SUFFIX]

              edit files in place (makes backup if extension supplied)

I'd say that if it's "in place", the symbolic link should be preserved
just like with "echo foo > file". But this is rather ambiguous.

Note that perl has the same behavior as sed, but its man page is
explicit about what is done:

   -i[extension]
       specifies that files processed by the "<>" construct are to be
       edited in-place.  It does this by renaming the input file, opening
       the output file by the original name, and selecting that output
       file as the default for print() statements.  [...]

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


Reply to: