如何让grep跳过搜索目录?

如何让grep跳过搜索目录?,grep,Grep,当我做一个grep foo*时,我会收到如下警告: grep: dir1: Is a directory grep: dir2: Is a directory grep: dir3: Is a directory grep: dir4: Is a directory grep: dir5: Is a directory 我宁愿只看到结果,而不是这些警告。grep foo*--directories=skip将像常规文件一样跳过对目录的搜索 根据手册页: 而且,grepfoo*-s也会做一些类似

当我做一个
grep foo*
时,我会收到如下警告:

grep: dir1: Is a directory
grep: dir2: Is a directory
grep: dir3: Is a directory
grep: dir4: Is a directory
grep: dir5: Is a directory
我宁愿只看到结果,而不是这些警告。

grep foo*--directories=skip
将像常规文件一样跳过对目录的搜索

根据手册页:

而且,
grepfoo*-s
也会做一些类似的令人满意的事情

 -d action, --directories=action
         Specify the demanded action for directories.  It is `read' by default, which means that the directories
         are read in the same manner as normal files.  Other possible values are `skip' to silently ignore the
         directories, and `recurse' to read them recursively, which has the same effect as the -R and -r option.
 -s, --no-messages
         Silent mode.  Nonexistent and unreadable files are ignored (i.e. their error messages are suppressed).