---
title: "grep: writing output: Broken pipe"
author: "standalone"
date: "2009-08-12T15:32:10Z"
tags: []
categories: ["编程语言"]
slug: "grep-writing-output-broken-pipe"
draft: false
lastmod: "2009-08-12T15:32:10Z"
id: 445584
url: "https://standalone.iteye.com/blog/445584"
---

```
ls -t $FOLDER | grep "stat"| head -$fileNum
```

我的python脚本里面call了一个shell脚本，里面有这一行，执行的时候就会有标题这样的warning。原因查了一下，是说head执行完了就exit了，因此grep面对的是一个没有reader的pipe，就是broken pipe了。

不会有啥坏处，不管它也没事，或者把输出的warning重定向到/dev/null也可以。