For ubuntu 12.04 bash scripts, I used to be able to run commands like the example below to overwrite files:
sudo echo 'line1
line2
line3' > /etc/some/config/file.conf
Ever since Ubuntu 14.04, I now have to break it up to get the same behaviour like so:
sudo echo 'line1
line2
line3' | sudo tee /etc/some/config/file.conf
I am guessing this is an extra security measure? Is there some way to go back to the old behaviour?
UPDATE
As some have correctly pointed out, this behaviour is consistent across Ubuntu 12.04 and Ubuntu 14.04. I believe I got mixed but because if one runs the command in a bash script called with sudo, then it executes fine, however, pasting the command into the CLI, it results in permission denied. I was comparing apples with oranges.