【发布时间】:2011-04-15 04:00:30
【问题描述】:
% cat temp
$$$ hello1
$$ hello2
hello3
## hello4
hello5 $$$
% cat temp | grep "$$$"
Illegal variable name.
% cat temp | grep "\$\$\$"
Variable name must contain alphanumeric characters.
%
我想为$$$ grep,我希望结果是
% cat temp | grep <what should go here?>
$$$ hello1
hello5 $$$
%
为了区分,我将提示标记为%。
- 这里有什么问题?
- grep 字符串应该是什么?
【问题讨论】:
-
你的第二个命令是正确的(用 $ 转义),但你需要使用单引号,而不是双引号。