How to get the exit status of a bash process sent to the backgroud in RHEL?

Solution Verified - Updated -

Issue

  • Once a process is sent to run in background, how can the exit status of the job be verified?
  • For example, a job is sent to the background and checked as follows:
$ sleep 10 &
[1] 22696
$ jobs
[1]+  Running                 sleep 10 &
$ jobs
[1]+  Done                    sleep 10
$

How can the exit status of the PID 22696 checked?

Environment

  • Red Hat Enterprise Linux (All)
  • bash

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