I have a better way of doing this which I've been meaning to implement, guess this is a good a way as any:

echo 'hello' | sudo tee /file

:neckbeard: :neckbeard: :neckbeard: