Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the ** glob character?

Tags:

gulp

glob

I have this path in my react gulpfile:

var path = {   HTML: 'src/index.html',   ALL: ['src/js/*.js', 'src/js/**/*.js', 'src/index.html'],   JS: ['src/js/*.js', 'src/js/**/*.js'],   MINIFIED_OUT: 'build.min.js',   DEST_SRC: 'dist/src',   DEST_BUILD: 'dist/build',   DEST: 'dist' }; 

What is the double glob character?

I know what the single glob is... but what is the double? single glob

like image 493
Jwan622 Avatar asked Sep 16 '15 09:09

Jwan622


People also ask

What are glob characters in Linux?

The Bash shell feature that is used for matching or expanding specific types of patterns is called globbing. Globbing is mainly used to match filenames or searching for content in a file. Globbing uses wildcard characters to create the pattern.

What is a glob in coding?

In computer programming, glob (/ɡlɑːb/) patterns specify sets of filenames with wildcard characters. For example, the Unix Bash shell command mv *. txt textfiles/ moves ( mv ) all files with names ending in .

What is a shell glob?

GLOB patterns or wildcard patterns. Characters that the shell will try to expand to match existing pathnames in the file system. These characters are sometimes called “wildcard” characters in other systems. A character that has a special meaning to the shell.

What does glob stand for Python?

glob (short for global) is used to return all file paths that match a specific pattern. We can use glob to search for a specific file pattern, or perhaps more usefully, search for files where the filename matches a certain pattern by using wildcard characters.


2 Answers

It's almost the same as the single asterisk but may consist of multiple directory levels.

In other words, while /x/*/y will match entries like:

/x/a/y /x/b/y 

and so on (with only one directory level in the wildcard section), the double asterisk /x/**/y will also match things like:

/x/any/number/of/levels/y 

with the concept of "any number of levels" also including zero (in other words, /x/**/y will match /x/y as one of its choices).


As an aside, as much as I hate to credit the mainframe with anything, I believe this has been used since the earlist days of MVS to allow selection of datasets at multiple levels :-)

like image 133
paxdiablo Avatar answered Oct 18 '22 11:10

paxdiablo


** matches any character including a forward-slash /
* matches any character except a forward-slash (to match just the file or directory name)

like image 27
Thomas S. Avatar answered Oct 18 '22 10:10

Thomas S.