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 1DqBe8-0006BQ-K5 for garchives@archives.gentoo.org; Wed, 06 Jul 2005 15:17:09 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j66FFOgk001317; Wed, 6 Jul 2005 15:15:24 GMT Received: from n082.sc1.cp.net (sp0155.sc1.cp.net [64.97.136.155]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j66FBcgl019007 for ; Wed, 6 Jul 2005 15:11:38 GMT Received: from wadham.oxford.ac.uk (82.20.10.146) by n082.sc1.cp.net (7.0.038) id 42C9ABA30005DE1A for gentoo-user@lists.gentoo.org; Wed, 6 Jul 2005 15:12:28 +0000 Received: by wadham.oxford.ac.uk (nbSMTP-0.99) for uid 1000 david.morgan@wadham.oxford.ac.uk; Wed, 6 Jul 2005 16:12:22 +0100 (BST) Date: Wed, 6 Jul 2005 16:12:18 +0100 From: David Morgan To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] sudo echo cannot write to /etc/ files ? Message-ID: <20050706151218.GA19645@valinor.dynalias.net> Mail-Followup-To: gentoo-user@lists.gentoo.org References: <42CBE237.7050508@planet.nl> <1120659727.13823.8.camel@capella.catmur.co.uk> <42CBF0B1.1020308@planet.nl> 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: text/plain; charset=utf8 Content-Disposition: inline In-Reply-To: <42CBF0B1.1020308@planet.nl> User-Agent: Mutt/1.5.8i X-Archives-Salt: 6accb921-0578-435f-b482-34bda6682517 X-Archives-Hash: bdb9e77a0f99021092f87c603d2cc941 On 16:54 Wed 06 Jul , Holly Bostick wrote: > OK, you all likely realize that I responded before I had got the three > more messages telling me what to do. > > I'm sure it will work (three people telling you the exact same thing is > pretty convincing ;-) ), but what I don't understand is why/how, if I > want to > > sudo echo 'media-video/xine-ui ~x86' >>/etc/portage/package.keywords > > changing that to > > "sudo echo media-video/xine-ui ~x86 >>/etc/portage/package.keywords" > > is going to write the line > > media-video/xine-ui ~x86 > > to /etc/portage/package.keywords-- i.e., why are the internal quotes no > longer necessary? > > Or should it be > > "sudo echo 'media-video/xine-ui ~x86' >>/etc/portage/package.keywords" > > or will that *really* screw everything up? > > (As you see, my understanding of bash is trying to improve, with only > very limited success :-) ). > 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 >>). 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. Dave -- gentoo-user@gentoo.org mailing list