Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: searching upwards from cwd



On Mon, Jun 19, 2006 at 11:03:57PM +0200, Dominik Vogt wrote:
> On Mon, Jun 19, 2006 at 11:13:28AM +0200, Marc Chantreux wrote:
> > le 19/06/2006,
> > Dominik Vogt nous écrivait :
> > > 
> > > I'd like to be able to open addresses.txt in a single command without knowing
> > > about the working directory.  At the moment, the command depends on cwd:
> > > 
> > >   work/  =>  less addresses.txt
> > >   work/cvs/  =>  less ../addresses.txt
> > >   work/cvs/projectx/  =>  less ../../addresses.txt
> > >   work/cvs/projectx/src/  =>  less ../../../addresses.txt
> > 
> > is this enought ? 
> > 
> > from () {
> >         local base=${PWD%/$1/*}/$1
> >         shift
> >         print -l $base/${~^*}
> > }
> > 
> > less $( from works '**/adresses.txt' )
> 
> Ah, that's not quite what I'm looking for.  It's too much to type
> - I could as well try an increasing numer of '../' components and
> hit TAB every time.

Hm, this is close:

  less (../)#adr*

But is there any way to prevent the globbing pattern is expanded
to multiple words?  I just want the first/shortest match.

Ciao

Dominik ^_^  ^_^

 --
Dominik Vogt, dominik.vogt@xxxxxx

Attachment: signature.asc
Description: Digital signature



Messages sorted by: Reverse Date, Date, Thread, Author