Bash Bunch,

I googled a bit and it see this problem asked several times, but I
never really saw a slick solution:

given this:

set -o pipefail
find / -type f -print 2>&1 |head -20
echo ${PIPESTATUS[*]}

prints this:
141 0

find fails because it has a bunch of output, but head only will accept
the first n lines.

This is a problem for me because I have trap ERR & errexit & pipefail activated.

The solution I will use will be to write the find output to a file,
then run head on it.

I am hoping that someone on the group has a more graceful solution.

BTW: I am not using find in my real script.  I just used that here so
anyone could reproduce the problem.

-- 
Michael Potter


Reply via email to