LFCS · Question #756
Which of the following command line redirection characters instructs the shell to read from the current input source until a specific word, on a separate line and without and trailing spaces, is…
The correct answer is A. <<. The << redirection operator signifies a 'here document,' instructing the shell to read input from the current source until a specified delimiter word is encountered on a separate line.
Question
Options
- A<<
- B<|
- C!<
- D&<<
How the community answered
(40 responses)- A90% (36)
- B3% (1)
- C3% (1)
- D5% (2)
Why each option
The `<<` redirection operator signifies a 'here document,' instructing the shell to read input from the current source until a specified delimiter word is encountered on a separate line.
The `<<` operator is used for a 'here document' which allows multi-line input to be provided directly within a shell script or from the command line. The shell reads all subsequent lines as standard input for the command until it encounters a specified delimiter word (on its own line, without leading/trailing spaces).
`<|` is not a standard shell redirection character for here documents; `<` redirects input from a file, and `|` creates a pipe.
`!<` is not a standard shell redirection character; `!` is generally used for history expansion in Bash.
`&<<` is not a standard shell redirection character; `&` is used for file descriptor manipulation or backgrounding, not in this combination for here documents.
Concept tested: Here document redirection <<
Source: https://www.gnu.org/software/bash/manual/bash.html#Here-Documents
Topics
Community Discussion
No community discussion yet for this question.