[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why sed -i does not respect the w mode?
From: |
Davide Brini |
Subject: |
Re: Why sed -i does not respect the w mode? |
Date: |
Thu, 29 Dec 2022 15:45:22 +0100 |
On Wed, 28 Dec 2022 18:34:39 -0600, Peng Yu <pengyu.ut@gmail.com> wrote:
> Hi,
>
> I turned off w of test.txt. But it still can be changed by sed -i.
> Should sed -i respect the w mode?
Whether the source file is writable or not doesn't matter to sed, since
it's never written to. With -i, sed creates a temporary file which is
renamed to the original name at the end (for both things, what matters are
the permissions on the containing directory, not those of the file).
--
D.