日期:2014-05-16  浏览次数:20692 次

linux报错 find: missing argument to `-exec'

在linux下使用find命令时,报错:find: missing argument to `-exec'

具体执行命令为:

find /u03 -name server.xml -exec grep '9080' {}\;

目的是查找/u03目录下名称为server.xml的文件,根据查找的结果进行grep搜索,搜索其中包含9080的文本。?

-exec语法格式为:?

-exec command {} \;

在{}和\之间必须要有空格,否则会报上面的错。?

加上空格之后重新执行命令:

find /u03 -name server.xml -exec grep '9080' {} \;

结果:

<Connector port ="9080" redirectPort ="9443" connectionTimeout ="20000" URIEncoding ="utf-8" 
               port="9080" protocol="HTTP/1.1" 
               port="9080" protocol="HTTP/1.1" 
<Connector port ="9080" redirectPort ="9443" connectionTimeout ="20000" URIEncoding ="utf-8" 
               port="9080" protocol="HTTP/1.1"