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.62) (envelope-from ) id 1HmUbx-0002uP-Ed for garchives@archives.gentoo.org; Fri, 11 May 2007 12:52:41 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.0/8.14.0) with SMTP id l4BCoUHU020462; Fri, 11 May 2007 12:50:30 GMT Received: from dcnode-01.unlimitedmail.net (139.Red-80-26-111.staticIP.rima-tde.net [80.26.111.139]) by robin.gentoo.org (8.14.0/8.14.0) with ESMTP id l4BCjhi1015190 for ; Fri, 11 May 2007 12:45:43 GMT Received: from ppp.zz ([137.204.208.98]) (authenticated bits=0) by dcnode-01.unlimitedmail.net (8.14.0/8.14.0) with ESMTP id l4BCjeus020626 for ; Fri, 11 May 2007 14:45:41 +0200 From: Etaoin Shrdlu To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] locate Date: Fri, 11 May 2007 15:18:39 +0200 User-Agent: KMail/1.9.5 References: <7ad4c500705110534i2b153fe1y38f8640ff10c4fec@mail.gmail.com> In-Reply-To: <7ad4c500705110534i2b153fe1y38f8640ff10c4fec@mail.gmail.com> 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="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200705111518.39433.shrdlu@unlimitedmail.org> X-UnlimitedMail-MailScanner-From: shrdlu@unlimitedmail.org X-Spam-Status: No X-Archives-Salt: a1569821-dbab-48b1-9e75-d9ce41e4c51d X-Archives-Hash: e1e5c77943d1d9fcfb309c7328c593f5 On Friday 11 May 2007 14:34, Martin S wrote: > Just recently tried using > > locate foo.conf | cd > > to automagically move to the directory in which I've saved foo.conf > Of course it didn't work as you can't cd to /bar/foo.conf It would not have worked anyway, since cd does not read its input from stdin. Try: [/]$ echo "etc" | cd -bash: echo: write error: Broken pipe [/]$ > I didn't find a way to dropping the actual file name from the result > of locate. > I did a brief google on locate, but didn't find a switch to drop the > actual file name from the result. It's not a locate problem. Use the "dirname" command. $ dirname /bar/foo.conf /bar $ and do something like cd $(dirname "$(locate foo.conf)") of course, make sure that the locate command returns just a single entry. -- gentoo-user@gentoo.org mailing list