On 13/07/09 20:11, ma wrote:
> Hi wonderful users of VIM,
>
> I constantly edit files while not in superuser mode and when I'm
> finished editing, I realize "Doh! I can't save it."
>
> Usually I have to temporary save my changes, and overwrite them. I
> googled to see what can be done to remedy this situation without ever
> exiting vim, and I found something like ":w !sudo tee %"
>
> That works fine on my ubuntu box, but @ work I'm using SuSE9 and there
> is no command "sudo"
>
> What I end up doing is something like this:
>
> ":w !su root tee %"
>
> but I get an error saying that /usr/bin/tee can not be executed.
>
> Anyone know what I'm doing wrong? I sort of have a hunch that this might
> be a shell question (using bash, fyi) rather than vim, but I'd love to
> hear some of your suggestions/solutions.
>
> Thanks very much in advance.

There _is_ a sudo command on SuSE, though perhaps you haven't installed 
it. The reason it is not necessarily installed is that SuSE believes 
that it's safer to log in to a root console (for  a time) while Ubuntu 
(and Debian) believe that no one should ever be allowed to start a root 
console ("they should log in to an ordinary username and wrap only the 
commands which need it into sudo"). Both approaches have their pros and 
cons, and I'm not going to discuss them here.

So:

- The current SuSE release is 11.1. You can get it from 
http://download.opensuse.org/ without even going to the computer shop.
- The relevant packages are sudo (with the program), yast2-sudo (to 
configure it), and maybe sudo-debuginfo and/or sudo-debugsource.

Of course, it's "at work", but anyway, if your "work" computer is still 
running SuSE 9.x, you should drop a hint by your sysadmin (or if he 
doesn't react, by his boss) that SuSE 9.x is already some years obsolete 
and that 11.1 is the current release with 11.2 coming in November.

tee gets its input from standard input. I'm not sure su gives its 
standard input to the program it runs. So IMHO it isn't a bash question 
but it could be a su question. Maybe your sysadmin didn't install sudo 
just _in order_ to forbid the kind of "sneaky root overwrites" that 
you're trying to do. So -- if you have the right to log in to root -- I 
guess your best bet is to save the file, then copy it where it belongs 
from a root console, as I gather you're already doing.


Best regards,
Tony.
-- 
Census Taker to Housewife: Did you ever have the measles, and, if so,
how many?

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to