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 1DqBwT-0001aV-Lo for garchives@archives.gentoo.org; Wed, 06 Jul 2005 15:36:06 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j66FXFSh031240; Wed, 6 Jul 2005 15:33:15 GMT Received: from heisenberg.zen.co.uk (heisenberg.zen.co.uk [212.23.3.141]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j66FPLeD023965 for ; Wed, 6 Jul 2005 15:25:21 GMT Received: from [82.69.83.178] (helo=desiato.digimed.co.uk) by heisenberg.zen.co.uk with esmtp (Exim 4.30) id 1DqBmw-0000i8-PQ for gentoo-user@lists.gentoo.org; Wed, 06 Jul 2005 15:26:14 +0000 Received: from hactar.digimed.co.uk (hactar.digimed.co.uk [192.168.1.2]) by desiato.digimed.co.uk (Postfix) with ESMTP id 02C061406264 for ; Wed, 6 Jul 2005 16:26:11 +0100 (BST) Date: Wed, 6 Jul 2005 16:26:07 +0100 From: Neil Bothwick To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] sudo echo cannot write to /etc/ files ? Message-ID: <20050706162607.08bed5f1@hactar.digimed.co.uk> In-Reply-To: <20050706151218.GA19645@valinor.dynalias.net> References: <42CBE237.7050508@planet.nl> <1120659727.13823.8.camel@capella.catmur.co.uk> <42CBF0B1.1020308@planet.nl> <20050706151218.GA19645@valinor.dynalias.net> Organization: Digital Media Production X-Mailer: Sylpheed-Claws 1.9.12 (GTK+ 2.6.8; x86_64-pc-linux-gnu) X-GPG-Fingerprint: 7260 0F33 97EC 2F1E 7667 FE37 BA6E 1A97 4375 1903 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 Content-Type: multipart/signed; boundary="Signature_Wed__6_Jul_2005_16_26_07_+0100_ixa/pBtlkEC5UmO5"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Originating-Heisenberg-IP: [82.69.83.178] X-Archives-Salt: e29fb3ee-9aa1-4e7f-9d89-9fdb81877dca X-Archives-Hash: 5888055db78f4bf649e17febdc69f936 --Signature_Wed__6_Jul_2005_16_26_07_+0100_ixa/pBtlkEC5UmO5 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 6 Jul 2005 16:12:18 +0100, David Morgan wrote: > Nope, I don't think you can do it with sudo since bash uses whitespace > as a separator, so if you do sudo "echo foo >> bar", it'll look for a > single command "echo foo >> bar", which is not what you want - you want > a command echo with argument foo, and then redirect the output to bar > (the double quotes prevent bash from evaluating the whitespace or the > >>). You could do it with a shell script #!/bin/sh #Call this /usr/local/bin/suecho echo "$1" >>$2 Add /usr/local/bin/suecho to /etc/sudoers and you can do sudo suecho "media-video/xine-ui ~x86" /etc/portage/package.keywords --=20 Neil Bothwick Software: (n.) That which hardware manufacturers can blame for physical failures. --Signature_Wed__6_Jul_2005_16_26_07_+0100_ixa/pBtlkEC5UmO5 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCy/gTum4al0N1GQMRApvLAKCSDty/CxiT7jOf2XULWZ4Whf672gCgiEwI EUzhxiLpp1rWx7Dm9kv3IBQ= =KmBr -----END PGP SIGNATURE----- --Signature_Wed__6_Jul_2005_16_26_07_+0100_ixa/pBtlkEC5UmO5-- -- gentoo-user@gentoo.org mailing list