Unix wildcard selectors? (Asterisks)

unix

Solution

It says to go into all the subdirectories below tmp, as well as just the content of tmp.

e.g. I have the following:

$ find tmp
tmp
tmp/a
tmp/a/b
tmp/a/b/file1
tmp/b
tmp/b/c
tmp/b/c/file2

matched output:

$ echo tmp/*
tmp/a tmp/b

matched output:

$ echo tmp/**/*
tmp/a tmp/a/b tmp/a/b/file1 tmp/b tmp/b/c tmp/b/c/file2

It is a default feature of zsh, to get it to work in bash 4, you perform:

shopt -s globstar

Problem

In Ryan Bates' Railscast about git, his .gitignore file contains the following line: `tmp/**/*` What is the purpose of using the double asterisks followed by an asterisk as such: `**/*`? Would using simply `tmp/*` instead of `tmp/**/*` not achieve the exact same result? Googling the issue, I found an unclear IBM article about it, and I was wondering if someone could clarify the issue.

Original source