Skip to main content
Add Bash syntax highlighting
Source Link
Benjamin Loison
  • 5.8k
  • 4
  • 20
  • 37

This syntax

--exclude-dir={dir1,dir2} 

is expanded by the shell (e.g. Bash), not by grep, into this:

--exclude-dir=dir1 --exclude-dir=dir2 

Quoting will prevent the shell from expanding it, so this won't work:

--exclude-dir='{dir1,dir2}' <-- this won't work 

The patterns used with --exclude-dir are the same kind of patterns described in the man page for the --exclude option:

--exclude=GLOB Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. 

The shell will generally try to expand such a pattern itself, so to avoid this, you should quote it:

--exclude-dir='dir?' 
--exclude-dir='dir?' 

You can use the curly braces and quoted exclude patterns together like this:

--exclude-dir={'dir?','dir??'} 
--exclude-dir={'dir?','dir??'} 

This syntax

--exclude-dir={dir1,dir2} 

is expanded by the shell (e.g. Bash), not by grep, into this:

--exclude-dir=dir1 --exclude-dir=dir2 

Quoting will prevent the shell from expanding it, so this won't work:

--exclude-dir='{dir1,dir2}' <-- this won't work 

The patterns used with --exclude-dir are the same kind of patterns described in the man page for the --exclude option:

--exclude=GLOB Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. 

The shell will generally try to expand such a pattern itself, so to avoid this, you should quote it:

--exclude-dir='dir?' 

You can use the curly braces and quoted exclude patterns together like this:

--exclude-dir={'dir?','dir??'} 

This syntax

--exclude-dir={dir1,dir2} 

is expanded by the shell (e.g. Bash), not by grep, into this:

--exclude-dir=dir1 --exclude-dir=dir2 

Quoting will prevent the shell from expanding it, so this won't work:

--exclude-dir='{dir1,dir2}' <-- this won't work 

The patterns used with --exclude-dir are the same kind of patterns described in the man page for the --exclude option:

--exclude=GLOB Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. 

The shell will generally try to expand such a pattern itself, so to avoid this, you should quote it:

--exclude-dir='dir?' 

You can use the curly braces and quoted exclude patterns together like this:

--exclude-dir={'dir?','dir??'} 
Would have sworn I had carefully tested it, but the last example seems to have been wrong.
Source Link
Derek Veit
  • 3.9k
  • 2
  • 18
  • 15

This syntax

--exclude-dir={dir1,dir2} 

is expanded by the shell (e.g. Bash), not by grep, into this:

--exclude-dir=dir1 --exclude-dir=dir2 

Quoting will prevent the shell from expanding it, so this won't work:

--exclude-dir='{dir1,dir2}' <-- this won't work 

The patterns used with --exclude-dir are the same kind of patterns described in the man page for the --exclude option:

--exclude=GLOB Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. 

The shell will generally try to expand such a pattern itself, so to avoid this, you should quote it:

--exclude-dir='dir?' 

You can use the curly braces and quoted exclude patterns together like this:

--exclude-dir={'dir?','dir??'} 

A pattern can span multiple path segments:

--exclude-dir='some*/?lse' 

This would exclude a directory like topdir/something/else.

This syntax

--exclude-dir={dir1,dir2} 

is expanded by the shell (e.g. Bash), not by grep, into this:

--exclude-dir=dir1 --exclude-dir=dir2 

Quoting will prevent the shell from expanding it, so this won't work:

--exclude-dir='{dir1,dir2}' <-- this won't work 

The patterns used with --exclude-dir are the same kind of patterns described in the man page for the --exclude option:

--exclude=GLOB Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. 

The shell will generally try to expand such a pattern itself, so to avoid this, you should quote it:

--exclude-dir='dir?' 

You can use the curly braces and quoted exclude patterns together like this:

--exclude-dir={'dir?','dir??'} 

A pattern can span multiple path segments:

--exclude-dir='some*/?lse' 

This would exclude a directory like topdir/something/else.

This syntax

--exclude-dir={dir1,dir2} 

is expanded by the shell (e.g. Bash), not by grep, into this:

--exclude-dir=dir1 --exclude-dir=dir2 

Quoting will prevent the shell from expanding it, so this won't work:

--exclude-dir='{dir1,dir2}' <-- this won't work 

The patterns used with --exclude-dir are the same kind of patterns described in the man page for the --exclude option:

--exclude=GLOB Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. 

The shell will generally try to expand such a pattern itself, so to avoid this, you should quote it:

--exclude-dir='dir?' 

You can use the curly braces and quoted exclude patterns together like this:

--exclude-dir={'dir?','dir??'} 
added 1 character in body
Source Link
Derek Veit
  • 3.9k
  • 2
  • 18
  • 15

This syntax

--exclude-dir={dir1,dir2} 

is expanded by the shell (e.g. Bash), not by grep, into this:

--exclude-dir=dir1 --exclude-dir=dir2 

Quoting will prevent the shell from expanding it, so this won't work:

--exclude-dir='{dir1,dir2}' <-- this won't work 

The patterns used with --exclude-dir are the same kind of patterns described in the man page for the --exclude option:

--exclude=GLOB Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. 

The shell will generally try to expand such a pattern itself, so to avoid this, you should quote it:

--exclude-dir='dir?' 

You can use the curly braces and quoted grepexclude patterns together like this:

--exclude-dir={'dir?','dir??'} 

A pattern can span multiple path segments:

--exclude-dir='some*/?lse' 

This would exclude a directory like topdir/something/else.

This syntax

--exclude-dir={dir1,dir2} 

is expanded by the shell (e.g. Bash), not by grep, into this:

--exclude-dir=dir1 --exclude-dir=dir2 

Quoting will prevent the shell from expanding it, so this won't work:

--exclude-dir='{dir1,dir2}' <-- this won't work 

The patterns used with --exclude-dir are the same kind of patterns described in the man page for the --exclude option:

--exclude=GLOB Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. 

The shell will generally try to expand such a pattern itself, so to avoid this, you should quote it:

--exclude-dir='dir?' 

You can use the curly braces and quoted grep patterns together like this:

--exclude-dir={'dir?','dir??'} 

A pattern can span multiple path segments:

--exclude-dir='some*/?lse' 

This would exclude a directory like topdir/something/else.

This syntax

--exclude-dir={dir1,dir2} 

is expanded by the shell (e.g. Bash), not by grep, into this:

--exclude-dir=dir1 --exclude-dir=dir2 

Quoting will prevent the shell from expanding it, so this won't work:

--exclude-dir='{dir1,dir2}' <-- this won't work 

The patterns used with --exclude-dir are the same kind of patterns described in the man page for the --exclude option:

--exclude=GLOB Skip files whose base name matches GLOB (using wildcard matching). A file-name glob can use *, ?, and [...] as wildcards, and \ to quote a wildcard or backslash character literally. 

The shell will generally try to expand such a pattern itself, so to avoid this, you should quote it:

--exclude-dir='dir?' 

You can use the curly braces and quoted exclude patterns together like this:

--exclude-dir={'dir?','dir??'} 

A pattern can span multiple path segments:

--exclude-dir='some*/?lse' 

This would exclude a directory like topdir/something/else.

Source Link
Derek Veit
  • 3.9k
  • 2
  • 18
  • 15
Loading