The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

fg - run jobs in the foreground

 SYNOPSIS



fg [job_id]

 DESCRIPTION

If job control is enabled (see the description of set -m), the fg utility will move a background job from the current environment (see Shell Execution Environment ) into the foreground.

Using fg to place a job into the foreground will remove its process ID from the list of those "known in the current shell execution environment"; see Lists .

 OPTIONS

None.

 OPERANDS

The following operand is supported:
job_id
Specify the job to be run as a foreground job. If no job_id operand is given, the job_id for the job that was most recently suspended, placed in the background or run as a background job will be used. The format of job_id is described in the entry for job control job ID in the XBD specification, Glossary  .

 STDIN

Not used.

 INPUT FILES

None.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of fg:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

The fg utility writes the command line of the job to standard output in the following format:

"%s\n", <command>

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

If job control is disabled, the fg utility will exit with an error and no job will be placed in the foreground.

 APPLICATION USAGE

The fg utility will not work as expected when it is operating in its own utility execution environment because that environment will have no applicable jobs to manipulate. See the APPLICATION USAGE section for bg. For this reason, fg is generally implemented as a shell regular built-in.

 EXAMPLES

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

bg, kill, jobs, wait.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]