Why does my bash script show messages like “foo.sh: line 55: wait_for: No record of process 60227”?

Solution Verified - Updated -

Issue

A bash script that activates the lastpipe behavior sometimes shows error messages like

foo.sh: line 55: wait_for: No record of process 60227

The script has the following characteristics:

  • Sets the lastpipe behavior
  • Has a “while read from a pipe” loop
  • The last command in the loop is a read from a pipe
  • At least one external command is executed inside the loop before the read

Example:

#!/bin/bash
shopt -s lastpipe
seq 1000 1010 | while read dummy1
do
  /bin/true
  /bin/true | read dummy2
done

Environment

  • Red Hat Enterprise Linux 7 (bash version 4.2.x)
  • Red Hat Enterprise Linux 8 (bash version 4.4.x)

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