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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.