FG(1P)

πŸ’– FG(1P) β€” the POSIX Programmer's Manual girlies' edition πŸ’–

okay so bestie, welcome to fg from the POSIX Programmer's Manual (yes, the FG(1P) one, that's her full name, she's iconic) ✨


🌸 PROLOG 🌸

bestie real talk for a sec: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so like, go consult the corresponding Linux manual page for details on Linux behavior, fr), or the interface may not be implemented on Linux at all. no cap. check before you get your hopes up πŸ’€


πŸŽ€ NAME πŸŽ€

fg β€” run jobs in the foreground πŸ’…


✨ SYNOPSIS ✨

fg [job_id]

that's it. that's the whole vibe. one optional little operand and she's ready 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so. if job control is enabled (peep the description of set -m if you need the deets), the fg utility shall move a background job from the current environment (that's Section 2.12, Shell Execution Environment, iykyk) into the foreground. main character energy, literally pulling your job out of the background and onto center stage πŸ‘‘

and here's the lowkey important part: using fg to place a job into the foreground shall remove its process ID from the list of those "known in the current shell execution environment". see Section 2.9.3.1, Examples for the receipts.


πŸ’… OPTIONS πŸ’…

None.

like. zero. none. she needs no flags, she's perfect as she is 🌈


πŸ“ OPERANDS πŸ“

the following operand shall be supported:

  • job_id β€” specify the job to be run as a foreground job. if you don't hand her a job_id operand, she'll use the job_id for the job that was most recently suspended, placed in the background, or run as a background job. the format of job_id is described in the Base Definitions volume of POSIX.1‐2017, Section 3.204, Job Control Job ID.

πŸ’œ STDIN πŸ’œ

Not used. she doesn't want your input bestie, she's got her own plans πŸ’…


🌈 INPUT FILES 🌈

None.


🧚 ENVIRONMENT VARIABLES 🧚

the following environment variables shall affect the execution of fg:

  • LANG β€” provide a default value for the internationalization variables that are unset or null. (see the Base Definitions volume of POSIX.1‐2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)
  • LC_ALL β€” if set to a non-empty string value, override the values of all the other internationalization variables.
  • LC_CTYPE β€” determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte 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 catalogs for the processing of LC_MESSAGES.

⭐ ASYNCHRONOUS EVENTS ⭐

Default.


πŸ’– STDOUT πŸ’–

the fg utility shall write the command line of the job to standard output in the following format:

"%s\n", <command>

verbatim, bestie. don't touch the format, that's her signature look ✨


πŸ™ˆ STDERR πŸ™ˆ

the standard error shall be used only for diagnostic messages.


πŸŽ€ OUTPUT FILES πŸŽ€

None.


🌸 EXTENDED DESCRIPTION 🌸

None.


πŸ”₯ EXIT STATUS πŸ”₯

the following exit values shall be returned:

  • 0 β€” successful completion. slay πŸ’…
  • >0 β€” an error occurred. not slay 😭

πŸ’€ CONSEQUENCES OF ERRORS πŸ’€

if job control is disabled, the fg utility shall exit with an error and no job shall be placed in the foreground. periodt. nothing happens. she just leaves.

the following sections are informative (aka the tea, not the rules β˜•).


🫢 APPLICATION USAGE 🫢

okay so this is the important lil heads-up: the fg utility does not work as expected when it is operating in its own utility execution environment, because that environment has no applicable jobs to manipulate. (see the APPLICATION USAGE section for bg for the same energy.) for this reason, fg is generally implemented as a shell regular built-in. that's the whole reason she lives inside your shell bestie, she needs the gossip (the job list) to function πŸ¦‹


🌈 EXAMPLES 🌈

None.


πŸ‘‘ RATIONALE πŸ‘‘

the extensions to the shell specified in this volume of POSIX.1‐2017 have mostly been based on features provided by the KornShell. the job control features provided by bg, fg, and jobs are also based on the KornShell. the standard developers examined the characteristics of the C shell versions of these utilities and found that differences exist. despite widespread use of the C shell, the KornShell versions were selected for this volume of POSIX.1‐2017, to maintain a degree of uniformity with the rest of the KornShell features selected (such as the very popular command line editing features). like, they wanted the whole fit to match, and honestly? valid πŸ’…


⭐ FUTURE DIRECTIONS ⭐

None.


πŸ”— SEE ALSO πŸ”—

Section 2.9.3.1, Examples, Section 2.12, Shell Execution Environment, bg, kill, jobs, wait

the Base Definitions volume of POSIX.1‐2017, Section 3.204, Job Control Job ID, Chapter 8, Environment Variables


portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page bestie!! brought to you by IEEE/The Open Group, dated 2017, and she ate every single time πŸ’…βœ¨ mwah, go foreground those jobs, ily, bye πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from