When I change files in cygwin bash with the sed command, the file gets locked.
Reproduce:
- Open
cmd
andcd
to non-user directory (f.e.temp
) echo aaa > test.txt
- Open in texteditor, add line, try to save => works
%CYGWIN_HOME%\bin\bash -c "sed -i 's/aaa/bbb/' test.txt
"- In texteditor, add another line and try to save => "Access denied"
WTF?! How can I sed a file without locking, or release the file handles afterwards?
Windows security permissions appear to be completely screwed on file:
Permissions before:
Permissions after:
It works however in user directory (
Desktop
)- I checked the file with LockHunter but no process appears to lock the file
- Cygwin FAQ mentions interferences with some programs. It tried uninstalling Antivir and Catalyst and rebooting.
- Trying
UnxTools(crashes),GnuWin32(sed doesn't support inplace substitution),Interex(installer doesn't support W7 Pro) ... * sigh *