我可以在grep
中使用-s
来抑制错误,但是在find
命令的man页面中没有找到类似的选项...唯一的选择是重定向STDERR>/dev/null吗?
或者有其他处理方法吗?(如果需要,可以考虑高级awk
和perl
解决方案)
例子:
$ for dir in `ls /mnt/16_c/`; do find /mnt/16_c/$dir/data/ -mtime +180 -type f -exec echo {} \;; done
find: `/mnt/16_c/test_container/dat/': No such file or directory
test -d /mnt/16_c/$dir/data/ && find ....
,因此根本不需要重定向。 - Stefan Hegny