From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1DqByG-0007zu-AT for garchives@archives.gentoo.org; Wed, 06 Jul 2005 15:37:56 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j66FYdJ8007648; Wed, 6 Jul 2005 15:34:39 GMT Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j66FRitl006594 for ; Wed, 6 Jul 2005 15:27:44 GMT Received: (qmail invoked by alias); 06 Jul 2005 15:28:36 -0000 Received: from 84-72-131-49.dclient.hispeed.ch (EHLO [127.0.0.1]) [84.72.131.49] by mail.gmx.net (mp030) with SMTP; 06 Jul 2005 17:28:36 +0200 X-Authenticated: #1076219 Message-ID: <42CBF8A3.6050103@gmx.ch> Date: Wed, 06 Jul 2005 17:28:35 +0200 From: Christoph Gysin User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050513) X-Accept-Language: en-us, en Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] sudo echo cannot write to /etc/ files ? References: <42CBE237.7050508@planet.nl> <1120659727.13823.8.camel@capella.catmur.co.uk> <42CBF0B1.1020308@planet.nl> <20050706151218.GA19645@valinor.dynalias.net> In-Reply-To: <20050706151218.GA19645@valinor.dynalias.net> X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-Archives-Salt: 32aeb8b5-f0c0-497f-bfe9-bfcba940e635 X-Archives-Hash: 8e926fb096ef8425a56e70dc1f48984b 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" org@fr33z3 -- gentoo-user@gentoo.org mailing list