You're viewing a comment by Jason and its responses.

Jason Permalink
April 23, 2010, 20:22

#3 is great -- I am always trying to edit files in /etc and forgetting to become root or use sudo.

But, based on your explanation, I'm not sure why the following doesn't work:

:w !sudo cat > %

It seems that should also be able to write to the file, but I get a permission error when I try it

:w !sudo cat > %
/bin/bash: /tmp/root.txt: Permission denied

shell returned 1

Any ideas?

Comment Responses

Pablo Permalink
June 23, 2010, 02:00

> is interpreted by your shell (with your rights).

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "disk_195": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.