David Morgan wrote:
> afaik you can only do it with su -c "echo foo >> bar", which stops bash
> from doing anything with the >> or the whitespace to begin with, but
> then passes everything inside the double quotes to another shell, which
> gets started by su -c
> 
> It's kind of annoying, I know, but I don't think there's a way round it
> with sudo.

Yes it is possible. But you need the shell (which handles the redirect)
to run as root.

$ sudo echo package ~x86 >> /etc/portage/package.keywords

will run the redirection as user, where:

$ sudo bash -c "echo package ~x86 >> /etc/portage/package.keywords"

will run the redirection as root.

For stuff like this, I'd recommend you to write simple shell functions:

addkeyword(){
  sudo bash -c "echo $* >> /etc/portage/package.keywords"
}

Write them in your .bashrc and their avaible when you need it.

Use it like this:

$ addkeyword package ~x86

Christoph
-- 
echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" [EMAIL PROTECTED]
-- 
gentoo-user@gentoo.org mailing list

Reply via email to