If one wants to create a file with some content, one might use:
echo 'my content' > new.conf
In the event that the target file requires elevated privileges, such as root access to write the file, one might think to just slap sudo on the front of it, as ever:
sudo echo 'my content' > new.conf
However, this just runs `echo` as root, and the target file still cannot be written. How might one overcome this?
OR sudo a chmod command that will allow writing -- plus, all of this sounds very much like a security breach in the making. Why are you writing to some type of conf file as a plain user? Do you want all unprivileged users to be able to change files that used to be protected?
I wouldn't take things so seriously. Ubuntu for example basically suggests you do all administration through sudo, and creating the config as the normal you is just good hygiene. Just make sure the file you commit is only writable by root!
Ah, nice one. I see you are invoking a new shell to perform the command. It's good that doing so only involves a few extra key presses. I'll have to add "sh -c" to my local memory banks