【发布时间】:2011-09-30 08:14:41
【问题描述】:
我从这样的 perl 脚本调用 find:
我的 $one_file = `find $search_dir -name "\*.$refinfilebase.search" -print |头-n 1`;如果我从 shell 执行它,我不会收到任何错误。此外,它将正确的值返回给 $one_file,但我在提示符下得到了这个:
发现:写入错误:断管为什么会这样?我怎样才能摆脱这个 find: write error: Broken pipe 消息?
【问题讨论】:
-
尝试从shell执行,是否出现同样的错误?
-
已编辑:如果我从 shell 执行它,我不会收到任何错误。此外,当从 Perl 调用时它返回正确的值,但我总是得到错误提示。
-
这可能会有所帮助:How to detect whether “find” found any matches? 请注意可能使用
-quit而不是head -n 1并提到head缓冲区已满。