Runs jobs in the foreground.
fg [ JobID ]
If job control is enabled (see "Job Control in the Korn Shell" in AIX Version 4.3 System User's Guide: Operating System and Devices), the fg command moves a background job in the current environment into the foreground. Use the JobID parameter to indicate a specific job to be run in the foreground. If this parameter is not supplied, the fg command uses the job most recently suspended, placed in the background, or run as a background job.
The JobID parameter can be a process ID number, or you can use one of the following symbol combinations:
|%Number||Refers to a job by the job number.|
|%String||Refers to a job whose name begins with the specified string.|
|%?String||Refers to a job whose name contains the specified string.|
|%+ OR %%||Refers to the current job.|
|%-||Refers to the previous job.|
Using the fg command to place a job into the foreground removes the job's process ID from the list of those known by the current shell environment.
The /usr/bin/fg command does not work when operating in its own command execution environment, because that environment does not have applicable jobs to manipulate. For this reason, the fg command is implemented as a Korn shell or POSIX shell regular built-in command.
The following exit values are returned:
|>0||An error occurred.|
If job control is disabled, the fg command exits with an error, and no job is placed in the foreground.
If the output of the job -l command shows the following job running in the background:
 + 16477 Running Sleep 100 &
use the process ID to run the sleep 100 & command in the foreground by entering:
The screen displays:
|/usr/bin/ksh||Contains the Korn shell fg built-in command.|
|/usr/bin/fg||Contains the fg command.|
The bg command, csh command, jobs command, kill command, wait command.
Job Control in the Korn Shell in AIX Version 4.3 System User's Guide: Operating System and Devices.