Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I once saw a colleague uses a tool which allows to use ** to represent any directories. For example: if a file called myfile.java sits deep inside:

src/main/com/mycompany/product/store/myfile.java

A command in the parent of src directory:

ls **/myfile.java

can list the file.

Can anyone tell me what tool it is? What package I need to use on Ubuntu to achieve this?

share|improve this question
1  
I think it is a dirty shellhack, dots always need special treatment when they are in a specific role. –  vakufo Mar 12 '12 at 18:47
2  
Hi. Sorry. I made a mistake. It is not ... but **. I have changed the original post. –  Kevin Zhang Mar 12 '12 at 19:13

1 Answer 1

up vote 5 down vote accepted

Try using the globstar option in bash; I believe that zsh has a similar option.

$ shopt -s globstar
$ echo pylib/**/pyerector.py
pylib/pyerector.py pylib/pyerector/pyerector.py

You can read more about it in the manpage.

share|improve this answer
1  
On zsh it's activated by default. –  Stéphane Gimenez Mar 12 '12 at 19:11
4  
Note that it's only available in version 4 of bash. –  Ignacio Vazquez-Abrams Mar 12 '12 at 19:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.