Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!decwrl!sgi!shinobu!odin!thestepchild!rhartman From: rhartman@thestepchild.sgi.com (Robert Hartman) Newsgroups: comp.unix.shell Subject: Re: Help with this script Message-ID: <1991Apr10.024244.14699@odin.corp.sgi.com> Date: 10 Apr 91 02:42:44 GMT References: <1991Apr9.164257.9128@agate.berkeley.edu> <1991Apr9.175008.12044@leland.Stanford.EDU> Sender: news@odin.corp.sgi.com (Net News) Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 18 In article <1991Apr9.175008.12044@leland.Stanford.EDU> rgupta@leland.Stanford.EDU (Rajesh Gupta) writes: > >How about: > > cd `find . -name -type d -print` Ooooh! I like this! Just cooked a version for csh: alias jd 'set arg="\!:1"; cd `(find . -name "*${arg}*" -type d -print) \ | head -1`' # jump to a directory You have to use a variable to capture the alias argument, because the history (argument) substitution syntax collides with the trailing * in the argument to -name. I want to go to the first match, so the head command is necessary to avoid "Ambiguous" errors. I have "," aliased to pop me back to the previous directory if find guesses wrong. -r