Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git grep别名在git配置文件中产生语法错误_Git - Fatal编程技术网

git grep别名在git配置文件中产生语法错误

git grep别名在git配置文件中产生语法错误,git,Git,我使用以下命令在代码中显示太长的行: git grep -n '.\{130,\}' *.*pp 但是,当我尝试使用它创建git别名时,如下所示: checkcpplines = grep -n '.\{130,\}' *.*pp 我收到以下错误消息: fatal: bad config line 15 in file /[...]/.gitconfig 我想问题来自于花括号,但我不知道如何解决它。你能尝试一下Git配置文件行中的反斜杠(\)需要转义,因为它们本身就是转义字符。因此

我使用以下命令在代码中显示太长的行:

git grep -n '.\{130,\}' *.*pp
但是,当我尝试使用它创建git别名时,如下所示:

    checkcpplines = grep -n '.\{130,\}' *.*pp
我收到以下错误消息:

fatal: bad config line 15 in file /[...]/.gitconfig

我想问题来自于花括号,但我不知道如何解决它。

你能尝试一下Git配置文件行中的反斜杠(
\
)需要转义,因为它们本身就是转义字符。因此:

checkcpplines = grep -n '.\{130,\}' *.*pp
无效,但:

checkcpplines = grep -n '.\\{130,\\}' *.*pp


这里有单引号这一事实并不相关,因为Git的引号规则是Git的,而不是一些shell的。

它与以下bash别名
alias checkcpplines=“grep-n.\{130,\}'
和下面的调用
checkcpplines`find-name*.*pp”一起工作`
。这就是您想要的吗?不,我想要.gicongif文件中的别名,调用
git checkcpplines
。谢谢。我尝试了你的解决方案,但我得到了一个语法错误。我意识到这是另一个错误(别名中没有“”。它适用于双“\”和无“”。