Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] locate
Date: Fri, 11 May 2007 14:18:00
Message-Id: 20070511150940.0e8d18b7@hactar.digimed.co.uk
In Reply to: Re: [gentoo-user] locate by Martin S
1 On Fri, 11 May 2007 15:53:42 +0200, Martin S wrote:
2
3 > Forgot you're still toppost sensitive in this group.
4
5 And always will be, once oyu've seen the one true way you don't change :)
6
7 > Anyway I don't have a mouse on that system, so I'll have to use Alan
8 > suggestion.
9
10 You could use a script. e.g.
11
12 #!/bin/sh
13 # cdlocate.sh
14 cd $(dirname $(locate $1 | head -n 1))
15
16 The head -n 1 will avoid it falling over when locate returns more than
17 one hit, although it will still break if there are no hits. Maybe,
18 although I haven't tested it, something like
19
20 FILE=$(locate "$*" | head -n 1))
21 [[ "${FILE}" ]] && cd $(dirname "${FILE}")
22
23
24 --
25 Neil Bothwick
26
27 Error reading FAT record: Try the SKINNY one? (Y/N)

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] locate "Bo Ørsted Andresen" <bo.andresen@××××.dk>