Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.utils.bug > #2183 > unrolled thread
| Started by | Bob Proulx <bob@proulx.com> |
|---|---|
| First post | 2015-07-03 19:51 -0600 |
| Last post | 2015-07-03 19:51 -0600 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.utils.bug
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: 'sed -i' fails if the file has sufficient perms but not its directory Bob Proulx <bob@proulx.com> - 2015-07-03 19:51 -0600
| From | Bob Proulx <bob@proulx.com> |
|---|---|
| Date | 2015-07-03 19:51 -0600 |
| Subject | Re: 'sed -i' fails if the file has sufficient perms but not its directory |
| Message-ID | <mailman.6268.1435974674.904.bug-gnu-utils@gnu.org> |
Toralf Förster wrote:
> I tried this, which won't work :
>
> tinderbox@tor-relay ~ $ sed -i -e 's/j1/j2/g' perl-5.22/etc/portage/make.conf
> sed: couldn't open temporary file perl-5.22/etc/portage/sedw9SFZf: Permission denied
Correct. If you want to use -i you will need write permission to the
directory. This is the same as other tools such as perl -i and awk -i too.
> whereas I'm allowed to edit that file as the user tinderbox
>
> tinderbox@tor-relay ~ $ vi perl-5.22/etc/portage/make.conf
The behavior depends upon the vi implementation. Some read it into
memory, some into spill files in /tmp, some into .swp files in the
same directory.
> /me wonders if sed relies on having a temp copy of that file in the same dir or not.
The documentation for sed says this:
'-i[SUFFIX]'
'--in-place[=SUFFIX]'
This option specifies that files are to be edited in-place. GNU
'sed' does this by creating a temporary file and sending output to
this file rather than to the standard output.(1).
...
When the end of the file is reached, the temporary file is renamed
to the output file's original name. The extension, if supplied, is
used to modify the name of the old file before renaming the
temporary file, thereby making a backup copy(2)).
Bob
Back to top | Article view | gnu.utils.bug
csiph-web