根据 GNU 文档:
‘\<’ Match the empty string at the beginning of word.
‘\>’ Match the empty string at the end of word.
Run Code Online (Sandbox Code Playgroud)
我的 /etc/fstab 看起来像这样:
/dev/sdb1 /media/fresh ext2 defaults 0 0
Run Code Online (Sandbox Code Playgroud)
我希望 grep 为 /media/fresh 的存在返回 TRUE/FALSE。我尝试使用\<
,\>
但没有用。为什么?
egrep '\</media/fresh\>' /etc/fstab
Run Code Online (Sandbox Code Playgroud)
egrep '[[:blank:]]/media/fresh[[:blank:]]' /etc/fstab
Run Code Online (Sandbox Code Playgroud)
但它看起来更丑。
我的 grep 是 2.5.1