Why I got 141 from PIPESTATUS using certain command line pipe ?

Solution Unverified - Updated -

Issue

  • Why I got 141 from PIPESTATUS using certain command line pipe ?

The user tried to get status code of certain command using PIPESTATUS array , and got strange return code.

aaa=`{ find . | head -1 ; echo ${PIPESTATUS[0]} ${PIPESTATUS[1]} ;  }`
echo $aaa

They expected that both of ${PIPESTATUS[0]} and ${PIPESTATUS[1]} will return 0.
But they found that sometimes, ${PIPESTATUS[0]} return strange return code 141.

]$ aaa=`{ find . | head -1 ; echo ${PIPESTATUS[0]} ${PIPESTATUS[1]} ;  }`
]$ echo $aaa
. 141 0

Why 'find .' returns code 141 ?

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content