Anthony Fletcher | 31 Jul 21:48

recurse up

One can find files that live below the current directory via

	ls **/README

but how can one look for files in the parent, grand-parent, ...
directories?

For example, suppose that the file /a/README exists and the current
directory is /a/b/c/d/e. Then, I'd like

	ls .../README

to glob expand to ../../../README.

Any suggestions?

			Anthony.

Mikael Magnusson | 31 Jul 21:56
Gravatar

Re: recurse up

2008/7/31 Anthony Fletcher <arif <at> dcb.cit.nih.gov>:
> One can find files that live below the current directory via
>
>        ls **/README
>
> but how can one look for files in the parent, grand-parent, ...
> directories?
>
> For example, suppose that the file /a/README exists and the current
> directory is /a/b/c/d/e. Then, I'd like
>
>        ls .../README
>
> to glob expand to ../../../README.
>
> Any suggestions?

The man page says:
       As a shorthand, `**/' is equivalent to `(*/)#'; note that this
therefore  matches
       files in the current directory as well as subdirectories.

So you can use (../)#README

--

-- 
Mikael Magnusson


Gmane