您的位置:首页 > 运维架构 > Linux

find:paths must precede expression问题及解决

2016-03-04 18:31 746 查看
用find命令查找时

例如命令

find /home -name w*

如下

find: paths must precede expression: webfd
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]


会出错,查文档找出

find: paths must precede expression

Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec]

[path…] [expression]

This happens because *.c has been expanded by the shell resulting in find

actually receiving a command line like this:

find . -name bigram.c code.c frcode.c locate.c -print


That command is of course not going to work. Instead of doingthings

this way, you should enclose the pattern in quotes or escape the wildcard:

$ find . -name '*.c' -print
或
$ find . -name \*.c -print


即出现这个提示是因为星号代表为当前目录下所有的文件,然后被当做shell展开
这就是网上说的多文件的查找的时候需要增加单引号
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  linux find