Last active
August 29, 2015 14:07
-
-
Save MatthewHannigan/fca0ca0f80b91234f17a to your computer and use it in GitHub Desktop.
bash expands {c,h} before the command sees it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo fish >a.c | |
$ grep -r --include=\*.{c,h} fish . | |
./a.c:fish | |
$ grep -r --include=\*.{c,h} fish . | |
./a.c:fish | |
grep doesn't like {c,h} | |
$ grep -r --include="*.{c,h}" fish . | |
$ grep -r --include="*.[ch]" fish . | |
./a.c:fish | |
and look at number of args - 6 v 5 | |
$ echo grep -r --include=\*.{c,h} fish . | wc | |
1 6 43 | |
$ echo grep -r --include="*.{c,h}" fish . | wc | |
1 5 33 | |
$ echo grep -r --include="*.{c,h}" fish . | |
grep -r --include=*.{c,h} fish . | |
$ echo grep -r --include=\*.{c,h} fish . | |
grep -r --include=*.c --include=*.h fish . | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment