Git.bash_profile-带有Git grep的函数不';我不能正常工作

Git.bash_profile-带有Git grep的函数不';我不能正常工作,bash,git,git-bash,Bash,Git,Git Bash,我的bash_配置文件中有以下(简化的)函数 function gg() { search=$1 search=\"$search\" echo "git grep -i $search" git grep -i $search } 我在搜索变量中添加了“-引号,因为搜索文字可以包含几个单词,而变量中不再有引号。 回音是正确的(例如,测试“who is there”-->git grep-i“who is the

我的bash_配置文件中有以下(简化的)函数

function gg()
{
    search=$1
    
    search=\"$search\"
    echo "git grep -i $search"
    git grep -i $search
}
我在搜索变量中添加了“-引号,因为搜索文字可以包含几个单词,而变量中不再有引号。 回音是正确的(例如,测试“who is there”-->git grep-i“who is there”),但我没有得到任何结果


你知道吗?

你在添加文字引号,而不是引用字符串。正确的方法是
git grep-i“$1”
完美!谢谢!