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 Sec‐
20       tion 2.12, Shell 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 Section 2.9.3.1, Examples.
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
33                 operand  is  given,  the  job_id  for  the  job that was most
34                 recently suspended, placed in the background,  or  run  as  a
35                 background  job  shall  be  used.  The  format  of  job_id is
36                 described in the Base  Definitions  volume  of  POSIX.1‐2017,
37                 Section 3.204, Job Control Job ID.
38

STDIN

40       Not used.
41

INPUT FILES

43       None.
44

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

70       Default.
71

STDOUT

73       The fg utility shall write the command line of the job to standard out‐
74       put in the following format:
75
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‐2017
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‐2017 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‐2017, 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-2017, Standard for Information Technology --  Por‐
135       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
136       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
137       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
138       event of any discrepancy between this version and the original IEEE and
139       The  Open Group Standard, the original IEEE and The Open Group Standard
140       is the referee document. The original Standard can be  obtained  online
141       at http://www.opengroup.org/unix/online.html .
142
143       Any  typographical  or  formatting  errors that appear in this page are
144       most likely to have been introduced during the conversion of the source
145       files  to  man page format. To report such errors, see https://www.ker
146       nel.org/doc/man-pages/reporting_bugs.html .
147
148
149
150IEEE/The Open Group                  2017                               FG(1P)
Impressum