I have this as a bash function:
function gits() {
git grep -i -n --color $@ -- $(git rev-parse --show-toplevel);
}
If I run this:
gits def add_crumb
I want:
git grep -i -n --color "def add_crumb" -- $(git rev-parse --show-toplevel)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The purpose of
$@is specifically to split it into individual arguments. Use"$*"if you don’t want that. (Yes, with the double quotes; you should have them in"$@"as well, actually.)