My grep version is grep (BSD grep) 2.5.1-FreeBSD and my operating system is OSX 10.13.3 (17D47)
I have a gitbook repo, and there is a temporary directory named _book which I want to ignore while using grep.
When I used grep -Fnrl mysql ./ --exclude-dir={_book}, it didn't exclude the _book directory. The result looks like
...
.//UTILITIES/my_utils/shell_scripts/get_several_days_mysql_data_log.sh
.//_book/search_jieba_index.dat
.//_book/LANGUAGES/awk/awk_magic.html
But the command grep -Fnrl mysql ./ --exclude-dir "_book" has gave me what I expected, the result looks like
...
.//UTILITIES/my_utils/shell_scripts/get_several_days_mysql_data_log.sh
I've searched on stackoverflow, and find a question which mentions the first command style and get 3 upvotes, so I guess it works under certain circumstances.
The question link is: Using grep with the --exclude-dir flag to exclude multiple directories
Why did this happen?
What should I do if I want to use the first command style to exclude _book successfully?