5

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?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Kevin Zhang
  • 161
  • 4

1 Answers1

8

In bash ≥4.0, turn on the globstar option.

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

You can read more about it in the manpage.

In zsh, this is available out of the box.

In ksh93, activate it with set -o globstar.

In plain sh or bash ≤3.x, this is not available.

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
Arcege
  • 22,287
  • 5
  • 56
  • 64