确认和负面预测给错误

对于使用ack-grep的问题,我有一个负面的问题。

我正在运行这个命令:

 ack-grep "paypal_responded(?!_at)" 

但我得到的错误:

 bash: !_at: event not found 

我已经尝试在各个地方添加反斜杠,但我也是使用ack和linux的新手,所以请把我当作任何指令的新手。

提前致谢。

尝试ack-grep 'paypal_responded(?!_at)'

你需要单引号来避免bash解释! 作为历史扩展命令。

shell正在解释! 在你的输入中作为一个命令替换:

 $ ack-grep root /etc/passwd root:x:0:0:root:/root:/bin/bash $ !ac ack-grep root /etc/passwd root:x:0:0:root:/root:/bin/bash $ 

你需要告诉shell ! 没有特别的意义; 有两种方法可以做到这一点:

 ack-grep "paypal_responded(?\!_at)" 

 ack-grep "paypal_responded\(?\!_at\)" 

要么

 ack-grep 'paypal_responded(?!_at)' 

单引号的字符串应用了更少的转换:

 $ ack-grep "s\!" /etc/passwd $ ack-grep 's!' /etc/passwd $