如何防止ZSH逃脱了争论中的后斜线以命令?
我在 zsh 中键入此行以找到一个后斜切,然后是小写n:pdfgrep“ \\ n”<一些路径>
(ps pdfgrep ,在pdfs上进行grep)
然后 zsh 将首先逃脱单个后背Backsslash,导致 pdfgrep 请参见“ \ n”< soming path>
,即搜索线feed(lf)。
如何防止 zsh 第一次逃脱命令中的反斜杠?
I type this line in zsh to find a backslash followed by a lowercase n:pdfgrep "\\n" <some path>
(P.S. pdfgrep, doing grep on PDFs)
Then zsh will first escape double backslash into a single backslash, resulting in what pdfgrep see is "\n" <some path>
, i.e. searching for a line feed (LF).
How to prevent zsh from first escaping backslash in arguments to command?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您好,希望您一切都好,
谢谢您的问题,我不知道PDFGREP:P
首先,我下载了PDF(这完全 https://www.docker.com/wp-content/uploads/2022/03/docker-cheat-cheat-cheat-sheat-sheet.pdf )
然后我尝试了简单:
但是您不知道。
然后像你一样,我尝试了这一点:
但是没有输出。
我决定尝试使用回声命令逃脱\ n进行测试:
正如预期的那样,这解释了\ n:
然后我尝试了此操作,但它也没有起作用:
然后我尝试了此操作,它与echo命令一起使用
:我决定在PDF上尝试它,但仍然没有输出:
然后,我找到了这个主题: PDFGREP模式要包含/排除线路破坏
并尝试过:
我认为这可以完成工作,是您想要的吗?
Bguess
hello, hope you are doing well,
Thank you for your question, I didnt know pdfgrep :p
First, I downloaded a pdf (this one exactly https://www.docker.com/wp-content/uploads/2022/03/docker-cheat-sheet.pdf)
then I tried the simple:
but didnt work as you know.
Then like you, I tried this:
but there was no output.
I decided to try to escape the \n with an echo command to test:
as expected, this interprete the \n:
then I tried this, but it didnt work also:
then I tried this, and it worked with the echo command:
So i decided to try it on the pdf, but still no output:
then, I have found this topic: pdfgrep pattern to include/exclude linebreak
and tried this:
I think this do the job, is it what you was looking for?
bguess