/var
由于挂在上,我无法搜索/var/run
。我尝试排除/var/run
,但未产生预期结果:
$ sudo grep -IR --exclude-dir="/var/run" '45.78.157.165' /var | egrep -v '(audit|access)'
/var/log/secure:Jun 21 14:08:34 cryptopp sshd[19729]: error: Received disconnect from 199.91.135.157: 3: com.jcraft.jsch.JSchException: reject HostKey: 45.78.157.165 [preauth]
/var/log/secure-20160626:Jun 21 14:08:34 cryptopp sshd[19729]: error: Received disconnect from 199.91.135.157: 3: com.jcraft.jsch.JSchException: reject HostKey: 45.78.157.165 [preauth]
/var/log/secure-20160626:Jun 21 14:08:34 cryptopp sshd[19729]: error: Received disconnect from 199.91.135.157: 3: com.jcraft.jsch.JSchException: reject HostKey: 45.78.157.165 [preauth]
grep: /var/run/saslauthd/mux: No such device or address
grep: /var/run/dbus/system_bus_socket: No such device or address
grep: /var/run/rpcbind.sock: No such device or address
grep: /var/run/udev/control: No such device or address
我已经尝试过-exclude-dir=/var/run
和-exclude-dir="/var/run"
。两者产生相同的结果。
为什么我的grep失败了?
如何/var/run
从递归grep中排除?
使用Grep的CentOS 7.2:
$ grep --version
grep (GNU grep) 2.20
Copyright (C) 2014 Free Software Foundation, Inc.
@JakeGould-是的;无论有没有。让我补充一下这个问题。
—
jww '16
@JakeGould没什么区别:
—
wchargin '16
grep
在任何情况下,该过程都看不到引号。Bash会扩展它们,并且无需执行替换操作,因此可以将其删除。我知道的所有外壳都是这种情况。
--exclude-dir=/var/run
不带引号的情况?