Why does redirection, using
sudo give me an error for the following commands?
$ sudo printf "foo" >/etc/file bash: /etc/file: Permission denied $ sudo printf "foo" ~/file; cat ~file >/etc/file bash: /etc/file: Permission denied
...yet I have no such problem when I use an editor, or
I don't think I've ever tried this before, so I don't know if there is something haywire on my system, or if this is normal. It seems a bit restrictive to be normal, but(?) maybe it is intended to be restrictive... (using Ubuntu)