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. -- [EMAIL PROTECTED] mailing list