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
11

NAME

13       fg — run jobs in the foreground
14

SYNOPSIS

16       fg [job_id]
17

DESCRIPTION

19       If job control is enabled (see the description of set −m), the fg util‐
20       ity  shall move a background job from the current environment (see Sec‐
21       tion 2.12, Shell Execution Environment) into the foreground.
22
23       Using fg to place a job into the foreground shall remove its process ID
24       from  the list of those ``known in the current shell execution environ‐
25       ment''; see Section 2.9.3.1, Examples.
26

OPTIONS

28       None.
29

OPERANDS

31       The following operand shall be supported:
32
33       job_id    Specify the job to be run as a foreground job. If  no  job_id
34                 operand  is  given,  the  job_id  for  the  job that was most
35                 recently suspended, placed in the background,  or  run  as  a
36                 background  job  shall  be  used.  The  format  of  job_id is
37                 described in the Base  Definitions  volume  of  POSIX.1‐2008,
38                 Section 3.204, Job Control Job ID.
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 vari‐
50                 ables that are unset or null. (See the Base Definitions  vol‐
51                 ume  of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
52                 ables for the precedence  of  internationalization  variables
53                 used to determine the values of locale categories.)
54
55       LC_ALL    If  set  to  a non-empty string value, override the values of
56                 all the other internationalization variables.
57
58       LC_CTYPE  Determine the locale for the interpretation of  sequences  of
59                 bytes of text data as characters (for example, single-byte as
60                 opposed to multi-byte characters in arguments).
61
62       LC_MESSAGES
63                 Determine the locale that should be used to affect the format
64                 and  contents  of  diagnostic  messages  written  to standard
65                 error.
66
67       NLSPATH   Determine the location of message catalogs for the processing
68                 of LC_MESSAGES.
69

ASYNCHRONOUS EVENTS

71       Default.
72

STDOUT

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

STDERR

80       The standard error shall be used only for diagnostic messages.
81

OUTPUT FILES

83       None.
84

EXTENDED DESCRIPTION

86       None.
87

EXIT STATUS

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

CONSEQUENCES OF ERRORS

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

APPLICATION USAGE

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

EXAMPLES

109       None.
110

RATIONALE

112       The  extensions  to  the shell specified in this volume of POSIX.1‐2008
113       have mostly been based on features provided by the KornShell.  The  job
114       control  features  provided  by  bg, fg, and jobs are also based on the
115       KornShell. The standard developers examined the characteristics of  the
116       C  shell  versions of these utilities and found that differences exist.
117       Despite widespread use of the C  shell,  the  KornShell  versions  were
118       selected  for  this volume of POSIX.1‐2008 to maintain a degree of uni‐
119       formity with the rest of the KornShell features selected (such  as  the
120       very popular command line editing features).
121

FUTURE DIRECTIONS

123       None.
124

SEE ALSO

126       Section  2.9.3.1,  Examples, Section 2.12, Shell Execution Environment,
127       bg, kill, jobs, wait
128
129       The Base Definitions volume of POSIX.1‐2008, Section 3.204, Job Control
130       Job ID, Chapter 8, Environment Variables
131
133       Portions  of  this text are reprinted and reproduced in electronic form
134       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
135       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
136       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
137       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
138       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  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.unix.org/online.html .
143
144       Any typographical or formatting errors that appear  in  this  page  are
145       most likely to have been introduced during the conversion of the source
146       files to man page format. To report such errors,  see  https://www.ker
147       nel.org/doc/man-pages/reporting_bugs.html .
148
149
150
151IEEE/The Open Group                  2013                               FG(1P)
Impressum