1FG(1P)                     POSIX Programmer's Manual                    FG(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       fg - run jobs in the foreground
13

SYNOPSIS

15       fg [job_id]
16

DESCRIPTION

18       If job control is enabled (see the description of set -m), the fg util‐
19       ity shall move a background job from the current environment (see Shell
20       Execution Environment ) into the foreground.
21
22       Using fg to place a job into the foreground shall remove its process ID
23       from  the  list of those "known in the current shell execution environ‐
24       ment''; see Asynchronous Lists .
25

OPTIONS

27       None.
28

OPERANDS

30       The following operand shall be supported:
31
32       job_id Specify the job to be run as a foreground job. If no job_id  op‐
33              erand  is  given,  the job_id for the job that was most recently
34              suspended, placed in the background, or run as a background  job
35              shall  be  used.  The  format of job_id is described in the Base
36              Definitions volume of IEEE Std 1003.1-2001, Section  3.203,  Job
37              Control Job ID.
38
39

STDIN

41       Not used.
42

INPUT FILES

44       None.
45

ENVIRONMENT VARIABLES

47       The following environment variables shall affect the execution of fg:
48
49       LANG   Provide  a  default value for the internationalization variables
50              that are unset or null. (See  the  Base  Definitions  volume  of
51              IEEE Std 1003.1-2001,  Section  8.2,  Internationalization Vari‐
52              ables for the precedence of internationalization variables  used
53              to determine the values of locale categories.)
54
55       LC_ALL If  set  to a non-empty string value, override the values of all
56              the other internationalization variables.
57
58       LC_CTYPE
59              Determine the locale for  the  interpretation  of  sequences  of
60              bytes  of  text  data as characters (for example, single-byte as
61              opposed to multi-byte characters in arguments).
62
63       LC_MESSAGES
64              Determine the locale that should be used to  affect  the  format
65              and contents of diagnostic messages written to standard error.
66
67       NLSPATH
68              Determine the location of message catalogs for the processing of
69              LC_MESSAGES .
70
71

ASYNCHRONOUS EVENTS

73       Default.
74

STDOUT

76       The fg utility shall write the command line of the job to standard out‐
77       put in the following format:
78
79
80              "%s\n", <command>
81

STDERR

83       The standard error shall be used only for diagnostic messages.
84

OUTPUT FILES

86       None.
87

EXTENDED DESCRIPTION

89       None.
90

EXIT STATUS

92       The following exit values shall be returned:
93
94        0     Successful completion.
95
96       >0     An error occurred.
97
98

CONSEQUENCES OF ERRORS

100       If job control is disabled, the fg utility shall exit with an error and
101       no job shall be placed in the foreground.
102
103       The following sections are informative.
104

APPLICATION USAGE

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

EXAMPLES

113       None.
114

RATIONALE

116       The  extensions  to   the   shell   specified   in   this   volume   of
117       IEEE Std 1003.1-2001 have mostly been based on features provided by the
118       KornShell. The job control features provided by bg, fg,  and  jobs  are
119       also based on the KornShell. The standard developers examined the char‐
120       acteristics of the C shell versions of these utilities and  found  that
121       differences exist. Despite widespread use of the C shell, the KornShell
122       versions were selected for this volume of IEEE Std 1003.1-2001 to main‐
123       tain  a  degree  of  uniformity with the rest of the KornShell features
124       selected (such as the very popular command line editing features).
125

FUTURE DIRECTIONS

127       None.
128

SEE ALSO

130       Asynchronous Lists, Shell  Execution  Environment,  bg,  kill(),  jobs,
131       wait()
132
134       Portions  of  this text are reprinted and reproduced in electronic form
135       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
136       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
137       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
138       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
139       event of any discrepancy between this version and the original IEEE and
140       The  Open Group Standard, the original IEEE and The Open Group Standard
141       is the referee document. The original Standard can be  obtained  online
142       at http://www.opengroup.org/unix/online.html .
143
144
145
146IEEE/The Open Group                  2003                               FG(1P)
Impressum