LFCS · Question #813
Which character, added to the end of a command, runs that command in the background as a child process of the current shell?
The correct answer is C. &. The ampersand character (&) appended to a command executes it in the background as a child process, allowing the shell to immediately return a prompt.
Question
Options
- A!
- B
- C&
- D%
- E
How the community answered
(32 responses)- B6% (2)
- C91% (29)
- D3% (1)
Why each option
The ampersand character (`&`) appended to a command executes it in the background as a child process, allowing the shell to immediately return a prompt.
The `!` character is primarily used for history expansion in most shells or as a logical NOT operator, not for backgrounding processes.
The `+` character is typically used in arithmetic expressions or as part of filename globbing patterns, not to run commands in the background.
Appending the `&` character to the end of a command sends the command to the background, allowing the shell to continue processing other commands immediately. This executes the command as a child process without waiting for its completion.
The `%` character is primarily used in job control to refer to specific background jobs, or for parameter expansion, not for initiating a background process.
The `#` character denotes a comment in shell scripts or commands; anything after it on the line is ignored by the shell.
Concept tested: Running processes in the background
Source: https://man7.org/linux/man-pages/man1/bash.1.html
Topics
Community Discussion
No community discussion yet for this question.