Globbing filetypes in bashrc for GREP

Trying to set GREP_OPTIONS to exclude certain file types in .bashrc.

GREP_OPTIONS=--exclude=*.{ext1,ext2,ext3*}
( ext3 may be ext3etc so need to account for that too)

This doesn't work. I've tried escaping various parts, quoting it different ways, but still nothing. Viewing the variable in the terminal just shows as typed in the .bashrc, exactly as above (obviously incorrect).

I used this method in a .cshrc file and it worked fine. When viewing the GREP_OPTIONS variable in the terminal, it would show as

GREP_OPTIONS=--exclude=*.ext --exclude=*.ext2

This question shows grep recognizes this style of globbing, and I've used it in the terminal and it works fine, but I just can't get it to work from within .bashrc.

How do I use globbing of this style in .bashrc?


您可以让shell在.bashrc执行此分配时扩展列表:

export GREP_OPTIONS="$(echo --exclude=*.{ext1,ext2,ext3*})"
链接地址: http://www.djcxy.com/p/47250.html

上一篇: 如何确定Git中更改行的唯一编号

下一篇: 为GREP在bashrc中全局化文件类型