Skip to content

How can I match ~/.bash* files but exclude ~/.bash_history? #2557

Answered by BurntSushi
OnlineCop asked this question in Q&A
Discussion options

You must be logged in to vote

Is there a way for a RipGrep glob filter (-g, --glob) to override explicitly-included command-name filenames (which may be the result of Bash globbing)?

No. This is by design. The driving design point here is that if you tell ripgrep to search a specific file, then it will absolutely do so regardless of any other flags. ripgrep doesn't know about shell globbing as that's expanded before ripgrep itself is invoked. So there is no way for ripgrep to tell the difference between "explicitly specified file" and "file that matched a shell glob."

If I were in your situation, I'd probably just specify the files you want to search explicitly since the list is small:

$ rg text .bashrc .bash_profil…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants