我正在贪图本地的svn目录.当我跑步时,grep -r "pattern" .我得到一些错误,如
grep:./ Data/test:没有这样的文件或目录
谁要求grep寻找不存在的文件?
>grep --version
grep (GNU grep) 2.10
>lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04 LTS
Run Code Online (Sandbox Code Playgroud)
dev*_*ull 25
默认情况下,grep不会忽略不存在或不可读的文件.您需要提供-s或--no-messages选项才能这样做.引用自man grep:
Run Code Online (Sandbox Code Playgroud)-s, --no-messages Suppress error messages about nonexistent or unreadable files. Portability note: unlike GNU grep, 7th Edition Unix grep did not conform to POSIX, because it lacked -q and its -s option behaved like GNU grep's -q option. USG-style grep also lacked -q but its -s option behaved like GNU grep. Portable shell scripts should avoid both -q and -s and should redirect standard and error output to /dev/null instead. (-s is specified by POSIX.)
| 归档时间: |
|
| 查看次数: |
11419 次 |
| 最近记录: |