sed permission denied when overwriting file

前端 未结 9 714
我在风中等你
我在风中等你 2021-01-11 12:07

I am trying to use sed to overwrite my index.php file, but I am getting an error:

$ sed -i \'s@@

        
9条回答
  •  梦谈多话
    2021-01-11 12:52

    Really no great answers here. Sorry if thread is dead, it came up in google searches and nothing really answered the question. Although altendky's answer is sort of the same as mine... There IS a workaround...find a world writable directory, say /tmp

    cp /etc/file_to_mod /tmp
    sed -i -e 's/foo/bar/g' /tmp/file_to_mod
    cat /tmp/file_to_mod >/etc_file_to_mod
    

    Hope that helps!

提交回复
热议问题