Using an unquoted delimiter with the standard here-document operator (<<) allows the shell to treat the body of the document like a double-quoted string: parameter expansion and command substitution occur. Crucially, all characters, including literal leading spaces, are copied to the command's standard input. This meets both requirements. Quoting the delimiter (<<'EOF') disables all expansions, so $SERVERNAME and $DOCROOT would be written literally. The <<- operator strips leading tab characters from each line of the document. Because the required indentation consists of spaces, this operator is not the correct tool for the job. The <<< operator is a here-string, not a here-document; it is designed to supply a single string to a command's standard input and is not the correct tool for embedding multi-line blocks of text. Therefore, the construction that uses an unquoted delimiter with << and a >> redirection is the only choice that satisfies both requirements.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the purpose of << in a Bash script?
Open an interactive chat with Bash
How does quoting the delimiter (<<'EOF') affect the output?
Open an interactive chat with Bash
What is the difference between << and <<< in Bash scripting?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
System Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access