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

NAME

6       fg - run jobs in the foreground
7

SYNOPSIS

9       fg [job_id]
10

DESCRIPTION

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

OPTIONS

21       None.
22

OPERANDS

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

STDIN

35       Not used.
36

INPUT FILES

38       None.
39

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

67       Default.
68

STDOUT

70       The fg utility shall write the command line of the job to standard out‐
71       put in the following format:
72
73
74              "%s\n", <command>
75

STDERR

77       The standard error shall be used only for diagnostic messages.
78

OUTPUT FILES

80       None.
81

EXTENDED DESCRIPTION

83       None.
84

EXIT STATUS

86       The following exit values shall be returned:
87
88        0     Successful completion.
89
90       >0     An error occurred.
91
92

CONSEQUENCES OF ERRORS

94       If job control is disabled, the fg utility shall exit with an error and
95       no job shall be placed in the foreground.
96
97       The following sections are informative.
98

APPLICATION USAGE

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

EXAMPLES

107       None.
108

RATIONALE

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

FUTURE DIRECTIONS

121       None.
122

SEE ALSO

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