【发布时间】:2014-01-20 22:40:49
【问题描述】:
我正在尝试在 git 存储库中 grep 单词 <template>。
我该如何为此写我的git grep 声明? (Shell 似乎假设 作为重定向参数)
(看起来这是特定于从 cmd 会话运行的 git for windows。Git Bash 工作正常)
【问题讨论】:
标签: git cmd escaping windows-shell msysgit
我正在尝试在 git 存储库中 grep 单词 <template>。
我该如何为此写我的git grep 声明? (Shell 似乎假设 作为重定向参数)
(看起来这是特定于从 cmd 会话运行的 git for windows。Git Bash 工作正常)
【问题讨论】:
标签: git cmd escaping windows-shell msysgit
使用 Git Bash,您应该能够简单地引用它:git grep "<template>"...。
通过 Windows 的 cmd.exe 运行 Git 有点不同。在那里,git grep ^<template^> ... 应该可以工作。这是因为cmd.exe 使用^ 作为其转义字符(而不是\,后者用于Bash、ZSH 和几乎所有其他shell)。
【讨论】:
git。
The system cannot find the file specified.
git grep "\<template\>"。如果是前者,这个答案指定的内容应该按原样工作。
git grep "\<template\>" 失败并出现错误 The syntax of the command is incorrect.