[英]Grep: Single vs Double Quotes
I'm trying to understand the difference of single and double quotes in these particular situations: 我试图了解在这些特定情况下单引号和双引号的区别:
egrep '^Za(za)+!$' *
returns Zaza!
返回Zaza!
and Zazazazaza!
和Zazazazaza!
(Which is what I want) (我想要的是什么)
egrep "^Za(za)+!$" *
returns the ones I mentioned above but also Zaaazazaaaa!
返回我上面提到的内容,还Zaaazazaaaa!
, Zaza
, Zazaza!Zazaza!
, Zaza
, Zazaza!Zazaza!
, Za!
, Za!
From my understanding, double quotes take the meanings of the symbols like +
into account, so why would the double quotes not work? 根据我的理解,双引号考虑了+
符号的含义,那么为什么双引号不起作用?
!$
is a history expansion that selects the last word from the previous command (so the result actually depends on that other command!). !$
是一个历史扩展 ,它从上一个命令中选择最后一个单词(因此结果实际上取决于另一个命令!)。 Those are processed inside double quotes but not inside single quotes . 它们在双引号中处理, 但不在单引号中处理 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.